Merge from vendor branch OPENSSH:
[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.30 2004/07/02 23:12:52 ru Exp $
19 .\" $DragonFly: src/usr.sbin/pkg_install/delete/Attic/pkg_delete.1,v 1.3 2004/07/30 04:46:13 dillon Exp $
20 .\"
21 .Dd June 29, 2004
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 dDfGinrvxX
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.
54 For extra protection, examine all
55 the package control files in the package record directory
56 .Pa ( /var/db/pkg/<pkg-name>/ ) .
57 Pay particular attention to any +INSTALL, +POST-INSTALL, +DEINSTALL,
58 +POST-DEINSTALL, +REQUIRE or +MTREE_DIRS files, and inspect the +CONTENTS
59 file for
60 .Cm @cwd ,
61 .Cm @mode
62 (check for setuid),
63 .Cm @dirrm ,
64 .Cm @exec ,
65 and
66 .Cm @unexec
67 directives, and/or use the
68 .Xr pkg_info 1
69 command to examine the installed package control files.
70 .Ef
71 .Sh OPTIONS
72 The following command line options are supported:
73 .Bl -tag -width indent
74 .It Ar pkg-name ...
75 The named packages are deinstalled.
76 .It Fl a
77 Unconditionally delete all currently installed packages.
78 .It Fl i
79 Request confirmation before attempting to delete each package,
80 regardless whether or not the standard input device is a
81 terminal.
82 .It Fl v
83 Turn on verbose output.
84 .It Fl D
85 If a deinstallation script exists for a given package, do not execute it.
86 .It Fl n
87 Don't actually deinstall a package, just report the steps that
88 would be taken if it were.
89 .It Fl p Ar prefix
90 Set
91 .Ar prefix
92 as the directory in which to delete files from any installed packages
93 which do not explicitly set theirs.
94 For most packages, the prefix will
95 be set automatically to the installed location by
96 .Xr pkg_add 1 .
97 .It Fl d
98 Remove empty directories created by file cleanup.
99 By default, only
100 files/directories explicitly listed in a package's contents (either as
101 normal files/directories or with the
102 .Cm @dirrm
103 directive) will be removed at deinstallation time.
104 This option tells
105 .Nm
106 to also remove any directories that were emptied as a result of removing
107 the package.
108 .It Fl f
109 Force removal of the package, even if a dependency is recorded or the
110 deinstall or require script fails.
111 .It Fl G
112 Do not try to expand shell glob patterns in the
113 .Ar pkg-name
114 when selecting packages to be deleted (by default
115 .Nm
116 automatically expands shell glob patterns in the
117 .Ar pkg-name ) .
118 .It Fl x
119 Treat the
120 .Ar pkg-name
121 as a regular expression and delete all packages whose names match
122 that regular expression.
123 Multiple regular expressions could be
124 provided, in that case
125 .Nm
126 deletes all packages that match at least one
127 regular expression from the list.
128 .It Fl X
129 Like
130 .Fl x ,
131 but treats the
132 .Ar pkg-name
133 as an extended regular expression.
134 .It Fl r
135 Recursive removal.
136 In addition to specified packages, delete all
137 packages that depend on those packages as well.
138 .El
139 .Sh TECHNICAL DETAILS
140 The
141 .Nm
142 utility
143 does pretty much what it says.
144 It examines installed package records in
145 .Pa /var/db/pkg/<pkg-name> ,
146 deletes the package contents, and finally removes the package records.
147 If the environment variable
148 .Ev PKG_DBDIR
149 is set, this overrides the
150 .Pa /var/db/pkg/
151 path shown above.
152 .Pp
153 If a package is required by other installed packages,
154 .Nm
155 will list those dependent packages and refuse to delete the package
156 (unless the
157 .Fl f
158 option is given).
159 .Pp
160 If the package contains a
161 .Ar require
162 file (see
163 .Xr pkg_create 1 ) ,
164 then this is executed first as
165 .Bd -ragged -offset indent -compact
166 .Cm require
167 .Ar <pkg-name>
168 .Ar DEINSTALL
169 .Ed
170 (where
171 .Ar pkg-name
172 is the name of the package in question and
173 .Ar DEINSTALL
174 is a keyword denoting that this is a deinstallation)
175 to see whether or not deinstallation should continue.
176 A non-zero exit
177 status means no, unless the
178 .Fl f
179 option is specified.
180 .Pp
181 If a
182 .Cm deinstall
183 script exists for the package, it is executed before any files are removed.
184 It is this script's responsibility to clean up any additional messy details
185 around the package's installation, since all
186 .Nm
187 knows how to do is delete the files created in the original distribution.
188 The
189 .Nm deinstall
190 script is called as:
191 .Bd -ragged -offset indent -compact
192 .Cm script
193 .Ar <pkg-name>
194 .Ar DEINSTALL
195 .Ed
196 where
197 .Ar pkg-name
198 is the name of the package in question and
199 .Ar DEINSTALL
200 is a keyword denoting this as the pre-deinstallation phase.
201 .Pp
202 .Sy Note :
203 The
204 .Ar DEINSTALL
205 keyword will not appear if separate scripts for deinstall and post-deinstall
206 are given during package creation time (using the
207 .Fl k
208 and
209 .Fl K
210 flags to
211 .Xr pkg_create 1 ) .
212 .Pp
213 If a
214 .Cm post-deinstall
215 script exists for the package, it is executed
216 .Cm after
217 all files are removed.
218 It is this script's responsibility to clean up any
219 additional messy details around the package's installation, and leave the
220 system (hopefully) in the same state that it was prior to the installation
221 of the package.
222 .Pp
223 The
224 .Nm post-deinstall
225 script is called as:
226 .Bd -ragged -offset indent -compact
227 .Cm script
228 .Ar <pkg-name>
229 .Ar POST-DEINSTALL
230 .Ed
231 where
232 .Ar pkg-name
233 is the name of the package in question and
234 .Ar POST-DEINSTALL
235 is a keyword denoting this as the post-deinstallation phase.
236 .Pp
237 .Sy Note :
238 The
239 .Ar POST-DEINSTALL
240 keyword will not appear if separate scripts for deinstall and post-deinstall
241 are given during package creation time (using the
242 .Fl k
243 and
244 .Fl K
245 flags to
246 .Xr pkg_create 1 ) .
247 .Pp
248 Reasoning behind passing keywords such as
249 .Ar DEINSTALL
250 and
251 .Ar POST-DEINSTALL
252 is that it lets you potentially write only one program/script that handles
253 all aspects of installation and deletion.
254 .Pp
255 But experience has proved that this is a lot more difficult to maintain and
256 is not as advantageous as having separate scripts that handle each aspect of
257 installation and deinstallation.
258 .Pp
259 All scripts are called with the environment variable
260 .Ev PKG_PREFIX
261 set to the installation prefix (see the
262 .Fl p
263 option above).
264 This allows a package author to write a script
265 that reliably performs some action on the directory where the package
266 is installed, even if the user might have changed it by specifying the
267 .Fl p
268 option when running
269 .Nm
270 or
271 .Cm pkg_add .
272 .Sh ENVIRONMENT
273 The environment variable
274 .Ev PKG_DBDIR
275 specifies an alternative location for the installed package database.
276 .Sh FILES
277 .Bl -tag -width /var/db/pkg -compact
278 .It Pa /var/db/pkg
279 Default location of the installed package database.
280 .El
281 .Sh SEE ALSO
282 .Xr pkg_add 1 ,
283 .Xr pkg_create 1 ,
284 .Xr pkg_info 1 ,
285 .Xr pkg_version 1 ,
286 .Xr mktemp 3 ,
287 .Xr mtree 8
288 .Sh AUTHORS
289 .An Jordan Hubbard
290 .Sh CONTRIBUTORS
291 .An John Kohl Aq jtk@rational.com ,
292 .An Oliver Eikemeier Aq eik@FreeBSD.org
293 .Sh BUGS
294 Sure to be some.