Initial import from FreeBSD RELENG_4:
[games.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 .\"
20 .Dd November 25, 1994
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 dDfGinrvx
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 r
123 Recursive removal.  In addition to specified packages, delete all
124 packages that depend on those packages as well.
125 .El
126 .Sh TECHNICAL DETAILS
127 The
128 .Nm
129 utility
130 does pretty much what it says.  It examines installed package records in
131 .Pa /var/db/pkg/<pkg-name> ,
132 deletes the package contents, and finally removes the package records.
133 If the environment variable
134 .Ev PKG_DBDIR
135 is set, this overrides the
136 .Pa /var/db/pkg/
137 path shown above.
138 .Pp
139 If a package is required by other installed packages,
140 .Nm
141 will list those dependent packages and refuse to delete the package
142 (unless the
143 .Fl f
144 option is given).
145 .Pp
146 If the package contains a
147 .Ar require
148 file (see
149 .Xr pkg_create 1 ) ,
150 then this is executed first as
151 .Bd -ragged -offset indent -compact
152 .Cm require
153 .Ar <pkg-name>
154 .Ar DEINSTALL
155 .Ed
156 (where
157 .Ar pkg-name
158 is the name of the package in question and
159 .Ar DEINSTALL
160 is a keyword denoting that this is a deinstallation)
161 to see whether or not deinstallation should continue.  A non-zero exit
162 status means no, unless the
163 .Fl f
164 option is specified.
165 .Pp
166 If a
167 .Cm deinstall
168 script exists for the package, it is executed before any files are removed.
169 It is this script's responsibility to clean up any additional messy details
170 around the package's installation, since all
171 .Nm
172 knows how to do is delete the files created in the original distribution.
173 The
174 .Nm deinstall
175 script is called as:
176 .Bd -ragged -offset indent -compact
177 .Cm script
178 .Ar <pkg-name>
179 .Ar DEINSTALL
180 .Ed
181 where
182 .Ar pkg-name
183 is the name of the package in question and
184 .Ar DEINSTALL
185 is a keyword denoting this as the pre-deinstallation phase.
186 .Pp
187 .Sy Note :
188 The
189 .Ar DEINSTALL
190 keyword will not appear if separate scripts for deinstall and post-deinstall
191 are given during package creation time (using the
192 .Fl k
193 and
194 .Fl K
195 flags to
196 .Xr pkg_create 1 ) .
197 .Pp
198 If a
199 .Cm post-deinstall
200 script exists for the package, it is executed
201 .Cm after
202 all files are removed.  It is this script's responsibility to clean up any
203 additional messy details around the package's installation, and leave the
204 system (hopefully) in the same state that it was prior to the installation
205 of the package.
206 .Pp
207 The
208 .Nm post-deinstall
209 script is called as:
210 .Bd -ragged -offset indent -compact
211 .Cm script
212 .Ar <pkg-name>
213 .Ar POST-DEINSTALL
214 .Ed
215 where
216 .Ar pkg-name
217 is the name of the package in question and
218 .Ar POST-DEINSTALL
219 is a keyword denoting this as the post-deinstallation phase.
220 .Pp
221 .Sy Note :
222 The
223 .Ar POST-DEINSTALL
224 keyword will not appear if separate scripts for deinstall and post-deinstall
225 are given during package creation time (using the
226 .Fl k
227 and
228 .Fl K
229 flags to
230 .Xr pkg_create 1 ) .
231 .Pp
232 Reasoning behind passing keywords such as
233 .Ar DEINSTALL
234 and
235 .Ar POST-DEINSTALL
236 is that it lets you potentially write only one program/script that handles
237 all aspects of installation and deletion.
238 .Pp
239 But experience has proved that this is a lot more difficult to maintain and
240 is not as advantageous as having separate scripts that handle each aspect of
241 installation and deinstallation.
242 .Pp
243 All scripts are called with the environment variable
244 .Ev PKG_PREFIX
245 set to the installation prefix (see the
246 .Fl p
247 option above).  This allows a package author to write a script
248 that reliably performs some action on the directory where the package
249 is installed, even if the user might have changed it by specifying the
250 .Fl p
251 option when running
252 .Nm
253 or
254 .Cm pkg_add .
255 .Sh ENVIRONMENT
256 The environment variable
257 .Ev PKG_DBDIR
258 specifies an alternative location for the installed package database.
259 .Sh FILES
260 .Bl -tag -width /var/db/pkg -compact
261 .It Pa /var/db/pkg
262 Default location of the installed package database.
263 .El
264 .Sh SEE ALSO
265 .Xr pkg_add 1 ,
266 .Xr pkg_create 1 ,
267 .Xr pkg_info 1 ,
268 .Xr pkg_version 1 ,
269 .Xr mktemp 3 ,
270 .Xr mtree 8
271 .Sh AUTHORS
272 .An Jordan Hubbard
273 .Sh CONTRIBUTORS
274 .An John Kohl Aq jtk@rational.com
275 .Sh BUGS
276 Sure to be some.