3c43e99343aa6134ff83af17b4c0d08044762716
[pkgsrc.git] / pkgtools / pkg_install / files / view / pkg_view.1
1 .\"     $NetBSD: pkg_view.1,v 1.11 2007/07/26 11:30:56 joerg Exp $
2 .\"
3 .\" Copyright (c) 2003 The NetBSD Foundation, Inc.
4 .\" All rights reserved.
5 .\"
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
8 .\" are met:
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\"    notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\"    notice, this list of conditions and the following disclaimer in the
13 .\"    documentation and/or other materials provided with the distribution.
14 .\" 3. All advertising materials mentioning features or use of this software
15 .\"    must display the following acknowledgement:
16 .\"        This product includes software developed by the NetBSD
17 .\"        Foundation, Inc. and its contributors.
18 .\" 4. Neither the name of The NetBSD Foundation nor the names of its
19 .\"    contributors may be used to endorse or promote products derived
20 .\"    from this software without specific prior written permission.
21 .\"
22 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
23 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
24 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
25 .\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
26 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 .\" POSSIBILITY OF SUCH DAMAGE.
33 .\"
34 .Dd September 8, 2003
35 .Dt PKG_VIEW 1
36 .Os
37 .Sh NAME
38 .Nm pkg_view
39 .Nd add and delete instances of depoted packages in views
40 .Sh SYNOPSIS
41 .Nm
42 .Op Fl nVv
43 .Op Fl d Ar stowdir
44 .Op Fl i Ar ignore
45 .Op Fl k Ar pkg_dbdir
46 .Op Fl W Ar viewbase
47 .Op Fl w Ar view
48 .Ar command
49 .Ar package ...
50 .Sh DESCRIPTION
51 The
52 .Nm
53 command is used to add and delete instances of depoted packages in
54 .Ar stowdir
55 in a
56 .Ar view
57 in the
58 .Ar viewbase
59 directory.
60 .Sh WARNING
61 .Bf -emphasis
62 Since the
63 .Nm
64 command may execute scripts or programs provided by a package file,
65 your system may be susceptible to
66 .Dq Trojan horses
67 or other subtle
68 attacks from miscreants who create dangerous package files.
69 .Pp
70 You are advised to verify the competence and identity of those who
71 provide installable package files.
72 For extra protection, examine all the package control files in the
73 package database directory
74 .Pa ( /usr/pkg/packages/\*[Lt]pkg-name\*[Gt]/ ) .
75 Pay particular attention to any
76 .Pa +INSTALL
77 or
78 .Pa +DEINSTALL
79 files, and inspect the
80 .Pa +CONTENTS
81 file for
82 .Cm @cwd ,
83 .Cm @mode
84 (check for setuid),
85 .Cm @dirrm ,
86 .Cm @exec ,
87 and
88 .Cm @unexec
89 directives, and/or use the
90 .Xr pkg_info 1
91 command to examine the installed package control files.
92 .Ef
93 .Sh OPTIONS
94 The following command-line options are supported:
95 .Bl -tag -width indent
96 .It Fl d Ar stowdir
97 Set
98 .Ar stowdir
99 as the directory in which the depoted packages can be found.
100 If this option isn't specified, then the
101 .Ar stowdir
102 is taken from the value of the environment variable
103 .Ev DEPOTBASE
104 if it's set, otherwise the default
105 .Ar stowdir
106 is the path to the
107 .Pa packages
108 directory under
109 .Ar viewbase .
110 .It Fl i Ar ignore
111 Add
112 .Ar ignore
113 to the list of files in
114 .Ar package
115 that should ignored when adding or removing the package instance from
116 .Ar view .
117 .It Fl k Ar pkg_dbdir
118 Set
119 .Ar pkg_dbdir
120 as the package database directory for the default (empty) view.
121 If this option isn't specified, then the package database directory is
122 taken from the value of the environment variable
123 .Ev PKG_DBDIR ,
124 otherwise it defaults to
125 .Pa /var/db/pkg .
126 .It Fl n
127 Don't actually execute the commands for manipulating the package instances.
128 .It Fl V
129 Print the version number and exit.
130 .It Fl v
131 Turn on verbose output.
132 Specifying
133 .Fl v
134 multiple times increases the level of verbosity.
135 .It Fl W Ar viewbase
136 Set
137 .Ar viewbase
138 as the directory in which all the views are managed.
139 The default
140 .Ar viewbase
141 directory is
142 .Pa /usr/pkg
143 but may be overridden by the
144 .Ev LOCALBASE
145 environment variable.
146 .It Fl w Ar view
147 Set
148 .Ar view
149 as the directory in
150 .Ar viewbase
151 in which the package instances should be added or deleted.
152 The default
153 .Ar view
154 is the empty view but may be overridden by the
155 .Ev PKG_VIEW
156 environment variable.
157 .El
158 .Pp
159 The following commands are supported:
160 .Bl -tag -width indent
161 .It Cm add
162 Add the listed package instances into
163 .Ar view .
164 .It Cm check
165 Check whether the listed package instances are present in
166 .Ar view .
167 If they are not present, then return 0, otherwise return 1.
168 .It Cm delete
169 Delete the listed package instances from
170 .Ar view .
171 .El
172 .Sh ENVIRONMENT
173 .Bl -tag -width indent
174 .It Ev DEPOTBASE
175 This is the location of the
176 .Ar stowdir
177 directory inside which all depoted packages are kept.
178 The default
179 .Ar stowdir
180 is the
181 .Pa packages
182 directory under
183 .Ar viewbase .
184 .It Ev LOCALBASE
185 This is the location of the
186 .Ar viewbase
187 directory in which all the views are managed.
188 The default
189 .Ar viewbase
190 directory is
191 .Pa /usr/pkg .
192 .It Ev PKG_DBDIR
193 If the
194 .Fl k
195 flag isn't given, then the value of the environment variable
196 .Ev PKG_DBDIR
197 is the package database directory for the default view,
198 otherwise it defaults to
199 .Pa /var/db/pkg .
200 .It Ev PLIST_IGNORE_FILES
201 This can be used to specify files in
202 .Ar package
203 that should ignored when adding or removing the package instance from
204 .Ar view .
205 .Ev PLIST_IGNORE_FILES
206 is a space-separated list of shell glob patterns that match files relative
207 to the
208 .Ar package
209 depot directory, and it defaults to "info/dir *[~#] *.OLD *.orig *,v".
210 This is overridden by any
211 .Ev _PLIST_IGNORE_FILES
212 setting in a package's
213 .Ar build-info-file
214 (see
215 .Xr pkg_create 1 )
216 if it exists.
217 .It Ev PKG_VIEW
218 The default view can be specified in the
219 .Ev PKG_VIEW
220 environment variable.
221 .El
222 .Sh FILES
223 .Bl -tag -width indent
224 .It Pa \*[Lt]pkg-dbdir\*[Gt]/\*[Lt]package\*[Gt]/+INSTALL
225 If the package contains an
226 .Ar install
227 script (see
228 .Xr pkg_create 1 ) ,
229 then after the package instance is added into a view, the script is
230 executed with the following arguments:
231 .Bl -tag -width package
232 .It Ar package
233 The name of the package instance being added.
234 .It Cm VIEW-INSTALL
235 Keyword denoting that the script is to perform any actions needed after
236 the package instance is added to a view.
237 .El
238 .Pp
239 If the
240 .Ar install
241 script exits with a non-zero status code, the installation is terminated.
242 .It Pa \*[Lt]pkg-dbdir\*[Gt]/\*[Lt]package\*[Gt]/+DEINSTALL
243 If the package contains an
244 .Ar deinstall
245 script (see
246 .Xr pkg_create 1 ) ,
247 then before the package instance is deleted from a view, the script is
248 executed with the following arguments:
249 .Bl -tag -width package
250 .It Ar package
251 The name of the package instance being deleted.
252 .It Cm VIEW-DEINSTALL
253 Keyword denoting that the script is to perform any actions needed before
254 the package instance is deleted from a view.
255 .El
256 .Pp
257 If the
258 .Ar deinstall
259 script exits with a non-zero status code, the de-installation is terminated.
260 .El
261 .Pp
262 The
263 .Ar install
264 and
265 .Ar deinstall
266 scripts are called with the environment variable
267 .Ev PKG_PREFIX
268 set to the path to the
269 .Ar view
270 directory.
271 .Sh SEE ALSO
272 .Xr linkfarm 1 ,
273 .Xr pkg_delete 1
274 .Sh AUTHORS
275 The
276 .Nm
277 utility was written by
278 .An Alistair G. Crooks Aq agc@NetBSD.org .