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