docs: def apply_(path, id_=None, config=None, approve_key=True, install=True,
             prep_install=False, pub_key=None, priv_key=None, mount_point=None):
      '''
      Seed a location (disk image, directory, or block device) with the
      minion config, approve the minion's key, and/or install salt-minion.
  
      CLI Example:
  
      .. code-block:: bash
  
          salt 'minion' seed.apply path id [config=config_data] \\
                  [gen_key=(true|false)] [approve_key=(true|false)] \\
                  [install=(true|false)]
  
      path
          Full path to the directory, device, or disk image  on the target
          minion's file system.
  
      id
          Minion id with which to seed the path.
  
      config
          Minion configuration options. By default, the 'master' option is set to
          the target host's 'master'.
  
      approve_key
          Request a pre-approval of the generated minion key. Requires
          that the salt-master be configured to either auto-accept all keys or
          expect a signing request from the target host. Default: true.
  
      install
          Install salt-minion, if absent. Default: true.
  
      prep_install
          Prepare the bootstrap script, but don't run it. Default: false
      '''
      stats = __salt__['file.stats'](path, follow_symlinks=True)
      if not stats:
          return '{0} does not exist'.format(path)
      ftype = stats['type']
      path = stats['target']
      log.debug('Mounting %s at %s', ftype, path)
      try:
          os.makedirs(path)
      except OSError:
          # The directory already exists
          pass
  
      mpt = _mount(path, ftype, mount_point)
  
      if not mpt:
          return '{0} could not be mounted'.format(path)
  
      tmp = os.path.join(mpt, 'tmp')
      log.debug('Attempting to create directory %s', tmp)
      try:
          os.makedirs(tmp)
      except OSError:
          if not os.path.isdir(tmp):
              raise
      cfg_files = mkconfig(config, tmp=tmp, id_=id_, approve_key=approve_key,
                           pub_key=pub_key, priv_key=priv_key)
  
      if _check_install(mpt):
          # salt-minion is already installed, just move the config and keys
          # into place
          log.info('salt-minion pre-installed on image, '
                   'configuring as %s', id_)
          minion_config = salt.config.minion_config(cfg_files['config'])
          pki_dir = minion_config['pki_dir']
          if not os.path.isdir(os.path.join(mpt, pki_dir.lstrip('/'))):
              __salt__['file.makedirs'](
                  os.path.join(mpt, pki_dir.lstrip('/'), '')
              )
          os.rename(cfg_files['privkey'], os.path.join(
              mpt, pki_dir.lstrip('/'), 'minion.pem'))
          os.rename(cfg_files['pubkey'], os.path.join(
              mpt, pki_dir.lstrip('/'), 'minion.pub'))
          os.rename(cfg_files['config'], os.path.join(mpt, 'etc/salt/minion'))
          res = True
      elif install:
          log.info('Attempting to install salt-minion to %s', mpt)
          res = _install(mpt)
      elif prep_install:
          log.error('The prep_install option is no longer supported. Please use '
                    'the bootstrap script installed with Salt, located at %s.',
                    salt.syspaths.BOOTSTRAP)
          res = False
      else:
          log.warning('No useful action performed on %s', mpt)
          res = False
  
      _umount(mpt, ftype)
      return res