| PKG_DELETE(1) | General Commands Manual | PKG_DELETE(1) | 
pkg_delete —
| pkg_delete | [ -ADFfkNnORrVv] [-Kpkg_dbdir] [-Pdestdir] [-pprefix] pkg-name ... | 
pkg_delete command is used to delete packages that
  have been previously installed with the
  pkg_add(1) command. The given
  packages are sorted, so that the dependencies needed by a package are deleted
  after the package. Before any action is executed,
  pkg_delete checks for packages that are marked as
  preserved or have depending packages left. If the
  -k flag is given, preserved packages are skipped and
  not removed. Unless the -f flag is given,
  pkg_delete stops on the first error.
pkg_delete command may
  execute scripts or programs provided by a package file, your system may be
  susceptible to “Trojan horses” or other subtle attacks from
  miscreants who create dangerous package files.
You are advised to verify the competence and identity of those who
    provide installable package files. For extra protection, examine all the
    package control files in the package record directory
    <PKG_DBDIR>/<pkg-name>/). Pay particular
    attention to any +INSTALL or
    +DEINSTALL files, and inspect the
    +CONTENTS file for @cwd,
    @mode (check for setuid),
    @dirrm, @exec, and
    @unexec directives, and/or use the
    pkg_info(1) command to
    examine the installed package control files.
-F flag is given, one or more (absolute) filenames
      may be specified and the package database will be consulted for the
      package to which the given file belongs. These packages are then
      deinstalled.-A-R flag.-D-F-f-ffpreserved package. Note that this is a dangerous
      operation. See also the -k option.-K
    pkg_dbdirPKG_DBDIR configuration
      option with the value pkg_dbdir.-kpreserved.-N@unexec lines either.-n-O-P
    destdir-p
    prefix-R-A flag.-r-V-vpkg_delete does pretty much what it says. It examines
  installed package records in
  <PKG_DBDIR>/<pkg-name>, deletes the
  package contents, and finally removes the package records.
If a package is required by other installed packages,
    pkg_delete will list those dependent packages and
    refuse to delete the package (unless the -f option
    is given).
If a package has been marked as a
    preserved package, it will not be able to be deleted
    (unless more than one occurrence of the -f option is
    given).
If a filename is given instead of a package name, the package of
    which the given file belongs to can be deleted if the
    -F flag is given. The filename needs to be absolute,
    see the output produced by the
    pkg_info(1)
    -aF command.
If a deinstall script exists for the
    package, it is executed before and after any files are removed. It is this
    script's responsibility to clean up any additional messy details around the
    package's installation, since all pkg_delete knows
    how to do is delete the files created in the original distribution. The
    deinstall script is called as:
deinstall
  ⟨pkg-name⟩
  DEINSTALLdeinstall
  ⟨pkg-name⟩
  POST-DEINSTALLAll scripts are called with the environment variable
    PKG_PREFIX set to the installation prefix (see the
    -p option above). This allows a package author to
    write a script that reliably performs some action on the directory where the
    package is installed, even if the user might have changed it by specifying
    the -p option when running
    pkg_delete or
    pkg_add(1). The scripts are
    also called with the PKG_METADATA_DIR environment
    variable set to the location of the +* meta-data
    files, and with the PKG_REFCOUNT_DBDIR environment
    variable set to the location of the package reference counts database
    directory. If the -P flag was given to
    pkg_delete, PKG_DESTDIR will
    be set to destdir.
| December 27, 2014 | NetBSD 10.1 |