]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - usr.sbin/pkg_install/delete/pkg_delete.1
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.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$
19 .\"
20 .Dd May 30, 2008
21 .Dt PKG_DELETE 1
22 .Os
23 .Sh NAME
24 .Nm pkg_delete
25 .Nd a utility for deleting previously installed software package distributions
26 .Sh SYNOPSIS
27 .Nm
28 .Op Fl dDfGinrvxX
29 .Op Fl p Ar prefix
30 .Ar pkg-name ...
31 .Nm
32 .Fl a
33 .Op Ar flags
34 .Sh DESCRIPTION
35 The
36 .Nm
37 command is used to delete packages that have been previously installed
38 with the
39 .Xr pkg_add 1
40 command.
41 .Sh WARNING
42 .Bf -emphasis
43 Since the
44 .Nm
45 command may execute scripts or programs provided by a package file,
46 your system may be susceptible to
47 .Dq Em trojan horses
48 or other subtle
49 attacks from miscreants who create dangerous package files.
50 .Pp
51 You are advised to verify the competence and identity of those who
52 provide installable package files.
53 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 , -all
76 Unconditionally delete all currently installed packages.
77 .It Fl i , -interactive
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 , -verbose
82 Turn on verbose output.
83 .It Fl D , -no-script , -no-scripts
84 If a deinstallation script exists for a given package, do not execute it.
85 .It Fl n , -dry-run
86 Do not actually deinstall a package, just report the steps that
87 would be taken if it were.
88 .It Fl p , -prefix 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.
93 For most packages, the prefix will
94 be set automatically to the installed location by
95 .Xr pkg_add 1 .
96 .It Fl d , -clean-dirs
97 Remove empty directories created by file cleanup.
98 By default, only
99 files/directories explicitly listed in a package's contents (either as
100 normal files/directories or with the
101 .Cm @dirrm
102 directive) will be removed at deinstallation time.
103 This option tells
104 .Nm
105 to also remove any directories that were emptied as a result of removing
106 the package.
107 .It Fl f , -force
108 Force removal of the package, even if a dependency is recorded or the
109 deinstall or require script fails.
110 .It Fl G , -no-glob
111 Do not try to expand shell glob patterns in the
112 .Ar pkg-name
113 when selecting packages to be deleted (by default
114 .Nm
115 automatically expands shell glob patterns in the
116 .Ar pkg-name ) .
117 .It Fl x , -regex
118 Treat the
119 .Ar pkg-name
120 as a regular expression and delete all packages whose names match
121 that regular expression.
122 Multiple regular expressions could be
123 provided, in that case
124 .Nm
125 deletes all packages that match at least one
126 regular expression from the list.
127 .It Fl X , -extended
128 Like
129 .Fl x ,
130 but treats the
131 .Ar pkg-name
132 as an extended regular expression.
133 .It Fl r , -recursive
134 Recursive removal.
135 In addition to specified packages, delete all
136 packages that depend on those packages as well.
137 .El
138 .Sh TECHNICAL DETAILS
139 The
140 .Nm
141 utility
142 does pretty much what it says.
143 It examines installed package records in
144 .Pa /var/db/pkg/<pkg-name> ,
145 deletes the package contents, and finally removes the package records.
146 If the environment variable
147 .Ev PKG_DBDIR
148 is set, this overrides the
149 .Pa /var/db/pkg/
150 path shown above.
151 .Pp
152 If a package is required by other installed packages,
153 .Nm
154 will list those dependent packages and refuse to delete the package
155 (unless the
156 .Fl f
157 option is given).
158 .Pp
159 If the package contains a
160 .Ar require
161 file (see
162 .Xr pkg_create 1 ) ,
163 then this is executed first as
164 .Bd -ragged -offset indent -compact
165 .Cm require
166 .Ar <pkg-name>
167 .Ar DEINSTALL
168 .Ed
169 (where
170 .Ar pkg-name
171 is the name of the package in question and
172 .Ar DEINSTALL
173 is a keyword denoting that this is a deinstallation)
174 to see whether or not deinstallation should continue.
175 A non-zero exit
176 status means no, unless the
177 .Fl f
178 option is specified.
179 .Pp
180 If a
181 .Cm deinstall
182 script exists for the package, it is executed before any files are removed.
183 It is this script's responsibility to clean up any additional messy details
184 around the package's installation, since all
185 .Nm
186 knows how to do is delete the files created in the original distribution.
187 The
188 .Nm deinstall
189 script is called as:
190 .Bd -ragged -offset indent -compact
191 .Cm script
192 .Ar <pkg-name>
193 .Ar DEINSTALL
194 .Ed
195 where
196 .Ar pkg-name
197 is the name of the package in question and
198 .Ar DEINSTALL
199 is a keyword denoting this as the pre-deinstallation phase.
200 .Pp
201 .Sy Note :
202 The
203 .Ar DEINSTALL
204 keyword will not appear if separate scripts for deinstall and post-deinstall
205 are given during package creation time (using the
206 .Fl k
207 and
208 .Fl K
209 flags to
210 .Xr pkg_create 1 ) .
211 .Pp
212 If a
213 .Cm post-deinstall
214 script exists for the package, it is executed
215 .Cm after
216 all files are removed.
217 It is this script's responsibility to clean up any
218 additional messy details around the package's installation, and leave the
219 system (hopefully) in the same state that it was prior to the installation
220 of the package.
221 .Pp
222 The
223 .Nm post-deinstall
224 script is called as:
225 .Bd -ragged -offset indent -compact
226 .Cm script
227 .Ar <pkg-name>
228 .Ar POST-DEINSTALL
229 .Ed
230 where
231 .Ar pkg-name
232 is the name of the package in question and
233 .Ar POST-DEINSTALL
234 is a keyword denoting this as the post-deinstallation phase.
235 .Pp
236 .Sy Note :
237 The
238 .Ar POST-DEINSTALL
239 keyword will not appear if separate scripts for deinstall and post-deinstall
240 are given during package creation time (using the
241 .Fl k
242 and
243 .Fl K
244 flags to
245 .Xr pkg_create 1 ) .
246 .Pp
247 Reasoning behind passing keywords such as
248 .Ar DEINSTALL
249 and
250 .Ar POST-DEINSTALL
251 is that it lets you potentially write only one program/script that handles
252 all aspects of installation and deletion.
253 .Pp
254 But experience has proved that this is a lot more difficult to maintain and
255 is not as advantageous as having separate scripts that handle each aspect of
256 installation and deinstallation.
257 .Pp
258 All scripts are called with the environment variable
259 .Ev PKG_PREFIX
260 set to the installation prefix (see the
261 .Fl p
262 option above).
263 This allows a package author to write a script
264 that reliably performs some action on the directory where the package
265 is installed, even if the user might have changed it by specifying the
266 .Fl p
267 option when running
268 .Nm
269 or
270 .Cm pkg_add .
271 .Sh ENVIRONMENT
272 The environment variable
273 .Ev PKG_DBDIR
274 specifies an alternative location for the installed package database.
275 .Sh FILES
276 .Bl -tag -width /var/db/pkg -compact
277 .It Pa /var/db/pkg
278 Default location of the installed package database.
279 .El
280 .Sh SEE ALSO
281 .Xr pkg_add 1 ,
282 .Xr pkg_create 1 ,
283 .Xr pkg_info 1 ,
284 .Xr pkg_version 1 ,
285 .Xr mktemp 3 ,
286 .Xr mtree 8
287 .Sh AUTHORS
288 .An Jordan Hubbard
289 .Sh CONTRIBUTORS
290 .An John Kohl Aq jtk@rational.com ,
291 .An Oliver Eikemeier Aq eik@FreeBSD.org
292 .Sh BUGS
293 Sure to be some.