1 .\" $NetBSD: pkg_delete.1,v 1.23 2009/08/16 21:10:15 joerg Exp $
3 .\" FreeBSD install - a package for the installation and maintenance
4 .\" of non-core utilities.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
18 .\" from FreeBSD: @(#)pkg_delete.1
25 .Nd a utility for deleting previously installed software package distributions
40 command is used to delete packages that have been previously installed
44 The given packages are sorted, so that the dependencies of a package
45 are deleted after the package.
46 Before any action is executed,
48 checks for packages that are marked as
50 or have depending packages left.
53 flag is given, preserved packages are removed from the list of packages
59 stops on the first error.
64 command may execute scripts or programs provided by a package file,
65 your system may be susceptible to
68 attacks from miscreants who create dangerous package files.
70 You are advised to verify the competence and identity of those who
71 provide installable package files.
72 For extra protection, examine all the package control files in the
73 package record directory
74 .Pa ( /var/db/pkg/\*[Lt]pkg-name\*[Gt]/ ) .
80 files, and inspect the
90 directives, and/or use the
92 command to examine the installed package control files.
95 The following command line options are supported:
96 .Bl -tag -width indent
98 The named packages are deinstalled, wildcards can be used, see
100 If no version is given, the one currently installed
104 flag is given, one or more (absolute) filenames may be specified and
105 the Package Database will be consulted for the package to which the
107 These packages are then deinstalled.
109 Recursively remove all automatically installed packages that were needed
110 by the given packages and are no longer required.
115 If a deinstallation script exists for a given package, do not execute it.
117 Any pkg-name given will be interpreted as pathname which is
118 subsequently transformed in a (real) package name via the Package
120 That way, packages can be deleted by giving a filename
121 instead of the package-name.
123 Force removal of the package, even if a dependency is recorded or the
124 deinstall script fails.
126 Force removal of the package, even if the package is marked as a
129 Note that this is a dangerous operation.
133 .It Fl K Ar pkg_dbdir
136 as the package database directory.
137 If this option isn't specified, then the package database directory is
138 taken from the value of the environment variable
140 if it's set, otherwise it defaults to
143 Silently skip all packages that are marked as
146 Remove the package's registration and its entries from the package database,
147 but leave the files installed.
148 Don't run any deinstall scripts or @unexec lines either.
150 Don't actually deinstall a package, just report the steps that
151 would be taken if it were.
153 Only delete the package's entries from the package database, do not
154 touch the package or its files itself.
156 Prefix all file and directory names with
158 For packages without install scripts this has the same behavior as
163 as the directory in which to delete files from any installed packages
164 which do not explicitly set theirs.
165 For most packages, the prefix will
166 be set automatically to the installed location by
169 Recursively remove all packages that were needed by the given packages
170 and that have no other dependencies left.
171 This option overrides the
175 Recursively remove all packages that require one of the packages given.
177 Print version number and exit.
179 Turn on verbose output.
181 .Sh TECHNICAL DETAILS
183 does pretty much what it says.
184 It examines installed package records in
185 .Pa /var/db/pkg/\*[Lt]pkg-name\*[Gt] ,
186 deletes the package contents, and finally removes the package records
187 (if an alternate package database directory is specified, then it
192 If a package is required by other installed packages,
194 will list those dependent packages and refuse to delete the package
199 If a package has been marked as a
201 package, it will not be able to be deleted
202 (unless more than one occurrence of the
206 If a filename is given instead of a package name, the package of which
207 the given file belongs to can be deleted if the
210 The filename needs to be absolute, see the output produced by the pkg_info
216 script exists for the package, it is executed before and after
217 any files are removed.
218 It is this script's responsibility to clean up any additional messy details
219 around the package's installation, since all
221 knows how to do is delete the files created in the original distribution.
225 .Bd -filled -offset indent -compact
230 before removing the package from a view, and as:
231 .Bd -filled -offset indent -compact
236 before deleting all files and as:
237 .Bd -filled -offset indent -compact
248 lets you potentially write only one program/script that handles all
249 aspects of installation and deletion.
251 All scripts are called with the environment variable
253 set to the installation prefix (see the
256 This allows a package author to write a script
257 that reliably performs some action on the directory where the package
258 is installed, even if the user might have changed it by specifying the
264 The scripts are also called with the
266 environment variable set to the location of the
268 meta-data files, and with the
269 .Ev PKG_REFCOUNT_DBDIR
270 environment variable set to the location of the package reference counts
280 .Bl -tag -width PKG_DBDIR
284 flag isn't given, then
286 is the location of the package database directory.
287 The default package database directory is
289 .It Ev PKG_REFCOUNT_DBDIR
290 Location of the package reference counts database directory.
291 The default location is the path to the package database directory with
293 appended to the path, e.g.
294 .Pa /var/db/pkg.refcount .
303 .Bl -tag -width indent -compact
311 wildcard dependency processing, pkgdb, recursive "down"
313 .It Joerg Sonnenberger
314 Rewrote most of the code to compute correct order of deinstallation
315 and to improve error handling.