PKG_DELETE(1) BSD Reference Manual PKG_DELETE(1)
pkg_delete - delete previously installed software package distributions
pkg_delete [-DFUcdfnqv] [-p prefix] pkg-name [...]
The pkg_delete command is used to delete packages that have been previ- ously installed with the pkg_add(1) command. Package names may be specified either as the package name with or without version, as the path of the installation log directory, or as a filename with suffix. If a name without version is given and there are multiple versions of the package installed (for example, with the autoconf packages), pkg_delete will fail. For example, the following will work: % pkg_delete libpixman-0.1.6-0 % pkg_delete libpixman % pkg_delete /usr/mpkg/db/pkg/libpixman-0.1.6-0/ % pkg_delete libpixman-0.1.6-0.cgz The options are as follows: pkg-name [...] The named packages are deinstalled. -D If a deinstallation script exists for a given package, do not ex- ecute it. -F If not running as root, try to uninstall the package anyway. -U Unregister the package but don't actually delete any files. Use- ful for upgrades of base packages, for example the pkgtools them- selves. Use with caution. -c Delete configuration files and directories, mentioned as @extra or @sample in the packing-list. -C Only delete configuration files that have the same checksum as the original file, i.e. those that have not been changed by the user. -d Remove empty directories created by file cleanup. By default, only files/directories explicitly listed in a package's contents (either as normal files/directories or with the @dirrm directive and a shared reference counter of 1) will be removed at deinstal- lation time. This option tells pkg_delete to also remove any directories that were emptied as a result of removing the pack- age. -f Force removal of the package, even if a dependency is recorded or the deinstall or require script fails. Also force removing base packages. Use with care. -n Don't actually deinstall a package, just report the steps that would be taken if it were. -p prefix Set prefix as the directory in which to delete files from any in- stalled packages which do not explicitly set theirs. For most packages, the prefix will be set automatically to the installed location by pkg_add(1). -q Delete package quickly, do not bother checking md5 sums before removing files. -v Turn on verbose output.
pkg_delete does pretty much what it says. It examines installed package records in $LOCALBASE/db/pkg/<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 the package contains a require file (see pkg_create(1)), then this is executed first as require <pkg-name> DEINSTALL (where pkg-name is the name of the package in question and DEINSTALL is a keyword denoting that this is a deinstallation) to see whether or not deinstallation should continue. A non-zero exit status means no, unless the -f option is specified. If a deinstall script exists for the package, it is executed before any files are removed. It is this script's responsibility to clean up any ad- ditional 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> DEINSTALL Passing the keyword DEINSTALL lets you potentially write only one program/script that handles all aspects of installation and deletion. All 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 direc- tory 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.
pkg_add(1), pkg_create(1), pkg_info(1), mkstemp(3), mtree(8)
Jordan Hubbard most of the work John Kohl refined it for NetBSD Thorsten Glaser MirOS adaptions. rcdb(3) based shared directory counting implementation. Benny Siegert various adaptions, dir/ support, -U option.
Since the pkg_delete command may execute scripts or programs provided by a package file, your system may be susceptible to "trojan horses" or oth- er subtle attacks from miscreants who create dangerous package files. You are advised to verify the competence and identity of those who pro- vide installable package files. For extra protection, examine all the package control files in the package record directory (/var/db/pkg/<pkg- name>/). Pay particular attention to any +INSTALL, +DEINSTALL, +REQUIRE or +MTREE_DIRS 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. MirOS BSD #10-current November 22, 2009 2
Generated on 2013-04-27 00:20:00 by $MirOS: src/scripts/roff2htm,v 1.77 2013/01/01 20:49:09 tg Exp $
These manual pages and other documentation are copyrighted by their respective writers;
their source is available at our CVSweb,
AnonCVS, and other mirrors. The rest is Copyright © 2002‒2013 The MirOS Project, Germany.
This product includes material provided by Thorsten Glaser.
This manual page’s HTML representation is supposed to be valid XHTML/1.1; if not, please send a bug report – diffs preferred.