Add the DragonFly cvs id and perform general cleanups on cvs/rcs/sccs ids. Most
[dragonfly.git] / usr.sbin / pkg_install / delete / pkg_delete.1
1 .\"
2 .\" FreeBSD install - a package for the installation and maintainance
3 .\" of non-core utilities.
4 .\"
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
7 .\" are met:
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\"    notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\"    notice, this list of conditions and the following disclaimer in the
12 .\"    documentation and/or other materials provided with the distribution.
13 .\"
14 .\" Jordan K. Hubbard
15 .\"
16 .\"
17 .\"     @(#)pkg_delete.1
18 .\" $FreeBSD: src/usr.sbin/pkg_install/delete/pkg_delete.1,v 1.16.2.9 2002/06/21 16:42:18 charnier Exp $
19 .\" $DragonFly: src/usr.sbin/pkg_install/delete/Attic/pkg_delete.1,v 1.2 2003/06/17 04:29:59 dillon Exp $
20 .\"
21 .Dd November 25, 1994
22 .Dt PKG_DELETE 1
23 .Os
24 .Sh NAME
25 .Nm pkg_delete
26 .Nd a utility for deleting previously installed software package distributions
27 .Sh SYNOPSIS
28 .Nm
29 .Op Fl dDfGinrvx
30 .Op Fl p Ar prefix
31 .Ar pkg-name ...
32 .Nm
33 .Fl a
34 .Op Ar flags
35 .Sh DESCRIPTION
36 The
37 .Nm
38 command is used to delete packages that have been previously installed
39 with the
40 .Xr pkg_add 1
41 command.
42 .Sh WARNING
43 .Bf -emphasis
44 Since the
45 .Nm
46 command may execute scripts or programs provided by a package file,
47 your system may be susceptible to
48 .Dq Em trojan horses
49 or other subtle
50 attacks from miscreants who create dangerous package files.
51 .Pp
52 You are advised to verify the competence and identity of those who
53 provide installable package files.  For extra protection, examine all
54 the package control files in the package record directory
55 .Pa ( /var/db/pkg/<pkg-name>/ ) .
56 Pay particular attention to any +INSTALL, +POST-INSTALL, +DEINSTALL,
57 +POST-DEINSTALL, +REQUIRE or +MTREE_DIRS files, and inspect the +CONTENTS
58 file for
59 .Cm @cwd ,
60 .Cm @mode
61 (check for setuid),
62 .Cm @dirrm ,
63 .Cm @exec ,
64 and
65 .Cm @unexec
66 directives, and/or use the
67 .Xr pkg_info 1
68 command to examine the installed package control files.
69 .Ef
70 .Sh OPTIONS
71 The following command line options are supported:
72 .Bl -tag -width indent
73 .It Ar pkg-name ...
74 The named packages are deinstalled.
75 .It Fl a
76 Unconditionally delete all currently installed packages.
77 .It Fl i
78 Request confirmation before attempting to delete each package,
79 regardless whether or not the standard input device is a
80 terminal.
81 .It Fl v
82 Turn on verbose output.
83 .It Fl D
84 If a deinstallation script exists for a given package, do not execute it.
85 .It Fl n
86 Don't actually deinstall a package, just report the steps that
87 would be taken if it were.
88 .It Fl p Ar prefix
89 Set
90 .Ar prefix
91 as the directory in which to delete files from any installed packages
92 which do not explicitly set theirs.  For most packages, the prefix will
93 be set automatically to the installed location by
94 .Xr pkg_add 1 .
95 .It Fl d
96 Remove empty directories created by file cleanup.  By default, only
97 files/directories explicitly listed in a package's contents (either as
98 normal files/directories or with the
99 .Cm @dirrm
100 directive) will be removed at deinstallation time.  This option tells
101 .Nm
102 to also remove any directories that were emptied as a result of removing
103 the package.
104 .It Fl f
105 Force removal of the package, even if a dependency is recorded or the
106 deinstall or require script fails.
107 .It Fl G
108 Do not try to expand shell glob patterns in the
109 .Ar pkg-name
110 when selecting packages to be deleted (by default
111 .Nm
112 automatically expands shell glob patterns in the
113 .Ar pkg-name ) .
114 .It Fl x
115 Treat the
116 .Ar pkg-name
117 as a regular expression and delete all packages whose names match
118 that regular expression.  Multiple regular expressions could be
119 provided, in that case
120 .Nm
121 deletes all packages that match at least one
122 regular expression from the list.
123 .It Fl r
124 Recursive removal.  In addition to specified packages, delete all
125 packages that depend on those packages as well.
126 .El
127 .Sh TECHNICAL DETAILS
128 The
129 .Nm
130 utility
131 does pretty much what it says.  It examines installed package records in
132 .Pa /var/db/pkg/<pkg-name> ,
133 deletes the package contents, and finally removes the package records.
134 If the environment variable
135 .Ev PKG_DBDIR
136 is set, this overrides the
137 .Pa /var/db/pkg/
138 path shown above.
139 .Pp
140 If a package is required by other installed packages,
141 .Nm
142 will list those dependent packages and refuse to delete the package
143 (unless the
144 .Fl f
145 option is given).
146 .Pp
147 If the package contains a
148 .Ar require
149 file (see
150 .Xr pkg_create 1 ) ,
151 then this is executed first as
152 .Bd -ragged -offset indent -compact
153 .Cm require
154 .Ar <pkg-name>
155 .Ar DEINSTALL
156 .Ed
157 (where
158 .Ar pkg-name
159 is the name of the package in question and
160 .Ar DEINSTALL
161 is a keyword denoting that this is a deinstallation)
162 to see whether or not deinstallation should continue.  A non-zero exit
163 status means no, unless the
164 .Fl f
165 option is specified.
166 .Pp
167 If a
168 .Cm deinstall
169 script exists for the package, it is executed before any files are removed.
170 It is this script's responsibility to clean up any additional messy details
171 around the package's installation, since all
172 .Nm
173 knows how to do is delete the files created in the original distribution.
174 The
175 .Nm deinstall
176 script is called as:
177 .Bd -ragged -offset indent -compact
178 .Cm script
179 .Ar <pkg-name>
180 .Ar DEINSTALL
181 .Ed
182 where
183 .Ar pkg-name
184 is the name of the package in question and
185 .Ar DEINSTALL
186 is a keyword denoting this as the pre-deinstallation phase.
187 .Pp
188 .Sy Note :
189 The
190 .Ar DEINSTALL
191 keyword will not appear if separate scripts for deinstall and post-deinstall
192 are given during package creation time (using the
193 .Fl k
194 and
195 .Fl K
196 flags to
197 .Xr pkg_create 1 ) .
198 .Pp
199 If a
200 .Cm post-deinstall
201 script exists for the package, it is executed
202 .Cm after
203 all files are removed.  It is this script's responsibility to clean up any
204 additional messy details around the package's installation, and leave the
205 system (hopefully) in the same state that it was prior to the installation
206 of the package.
207 .Pp
208 The
209 .Nm post-deinstall
210 script is called as:
211 .Bd -ragged -offset indent -compact
212 .Cm script
213 .Ar <pkg-name>
214 .Ar POST-DEINSTALL
215 .Ed
216 where
217 .Ar pkg-name
218 is the name of the package in question and
219 .Ar POST-DEINSTALL
220 is a keyword denoting this as the post-deinstallation phase.
221 .Pp
222 .Sy Note :
223 The
224 .Ar POST-DEINSTALL
225 keyword will not appear if separate scripts for deinstall and post-deinstall
226 are given during package creation time (using the
227 .Fl k
228 and
229 .Fl K
230 flags to
231 .Xr pkg_create 1 ) .
232 .Pp
233 Reasoning behind passing keywords such as
234 .Ar DEINSTALL
235 and
236 .Ar POST-DEINSTALL
237 is that it lets you potentially write only one program/script that handles
238 all aspects of installation and deletion.
239 .Pp
240 But experience has proved that this is a lot more difficult to maintain and
241 is not as advantageous as having separate scripts that handle each aspect of
242 installation and deinstallation.
243 .Pp
244 All scripts are called with the environment variable
245 .Ev PKG_PREFIX
246 set to the installation prefix (see the
247 .Fl p
248 option above).  This allows a package author to write a script
249 that reliably performs some action on the directory where the package
250 is installed, even if the user might have changed it by specifying the
251 .Fl p
252 option when running
253 .Nm
254 or
255 .Cm pkg_add .
256 .Sh ENVIRONMENT
257 The environment variable
258 .Ev PKG_DBDIR
259 specifies an alternative location for the installed package database.
260 .Sh FILES
261 .Bl -tag -width /var/db/pkg -compact
262 .It Pa /var/db/pkg
263 Default location of the installed package database.
264 .El
265 .Sh SEE ALSO
266 .Xr pkg_add 1 ,
267 .Xr pkg_create 1 ,
268 .Xr pkg_info 1 ,
269 .Xr pkg_version 1 ,
270 .Xr mktemp 3 ,
271 .Xr mtree 8
272 .Sh AUTHORS
273 .An Jordan Hubbard
274 .Sh CONTRIBUTORS
275 .An John Kohl Aq jtk@rational.com
276 .Sh BUGS
277 Sure to be some.