xref: /netbsd-src/external/bsd/pkg_install/dist/admin/pkg_admin.1 (revision 60ab2ca5c0570c0013b39de285ddaa91fe27d029)
1.\"	$NetBSD: pkg_admin.1,v 1.1.1.10 2010/01/30 21:33:27 joerg Exp $
2.\"
3.\" Copyright (c) 1999-2010 The NetBSD Foundation, Inc.
4.\" All rights reserved.
5.\"
6.\" This code is derived from software contributed to The NetBSD Foundation
7.\" by Hubert Feyrer <hubert@feyrer.de>.
8.\"
9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions
11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright
13.\"    notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\"    notice, this list of conditions and the following disclaimer in the
16.\"    documentation and/or other materials provided with the distribution.
17.\" 3. All advertising materials mentioning features or use of this software
18.\"    must display the following acknowledgement:
19.\"        This product includes software developed by the NetBSD
20.\"        Foundation, Inc. and its contributors.
21.\" 4. Neither the name of The NetBSD Foundation nor the names of its
22.\"    contributors may be used to endorse or promote products derived
23.\"    from this software without specific prior written permission.
24.\"
25.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
26.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
29.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35.\" POSSIBILITY OF SUCH DAMAGE.
36.\"
37.Dd January 22, 2010
38.Dt PKG_ADMIN 1
39.Os
40.Sh NAME
41.Nm pkg_admin
42.Nd perform various administrative tasks to the pkg system
43.Sh SYNOPSIS
44.Nm
45.Op Fl bqSVv
46.Op Fl C Ar config
47.Op Fl d Ar lsdir
48.Op Fl K Ar pkg_dbdir
49.Op Fl s Ar sfx_pattern
50.Ar command Op args ...
51.Sh DESCRIPTION
52This command performs various administrative tasks around the
53.Nx
54Packages System.
55.Sh OPTIONS
56The following command-line options are supported:
57.Bl -tag -width indent
58.It Fl b
59Print only the base names when matching package names for
60.Cm lsall
61and
62.Cm lsbest .
63.It Fl C Ar config
64Read the configuration file from
65.Ar config
66instead of the system default.
67.It Fl d Ar lsdir
68Set
69.Ar lsdir
70as the path to the directory in which to find matching package names for
71.Cm lsall
72and
73.Cm lsbest .
74.It Fl K Ar pkg_dbdir
75Override the value of the
76.Dv PKG_DBDIR
77configuration option with the value
78.Ar pkg_dbdir .
79.It Fl q
80Perform checks in a quiet manner.
81In normal operation,
82.Nm
83prints a
84.Sq \&.
85to standard output to indicate progress.
86This option suppresses this progress indicator.
87.It Fl S
88Set the shell glob pattern for package suffixes when matching package
89names for
90.Cm lsall
91and
92.Cm lsbest
93to be the null suffix.
94.It Fl s Ar sfx_pattern
95Set the shell glob pattern for package suffixes when matching package
96names for
97.Cm lsall
98and
99.Cm lsbest .
100The default pattern is ".t[bg]z".
101.It Fl V
102Print version number and exit.
103.It Fl v
104Be more verbose.
105.El
106.Pp
107The following commands are supported:
108.Bl -tag -width indent
109.It Cm add Ar pkg ...
110For each listed package, write the absolute pathnames of the files listed in
111its
112.Pa +CONTENTS
113file together with the package they belong to into the package database.
114This should be used only by
115.Xr pkg_view 1 .
116.It Cm audit Oo Fl es Oc Oo Fl t Ar type Oc Oo Ar pkg Oc ...
117Check the listed installed packages for vulnerabilities.
118If no package is given, check all installed packages.
119If
120.Fl e
121is given, also include end-of-life information.
122If
123.Fl s
124is given, check the signature of the pkg-vulnerabilities file before using it.
125.Fl t
126restricts the reported vulnerabilities to type
127.Ar type .
128.It Cm audit-pkg Oo Fl es Oc Oo Fl t Ar type Oc Oo Ar pkg Oc ...
129Like
130.Cm audit ,
131but check only the given package names or patterns.
132.It Cm audit-batch Oo Fl es Oc Oo Fl t Ar type Oc Oo Ar pkg-list Oc ...
133Like
134.Cm audit-pkg ,
135but read the package names or patterns one per line from the given files.
136.It Cm audit-history Oo Fl s Oc Oo Fl t Ar type Oc Oo Ar pkgbase Oc ...
137Print all vulnerabilities for the given base package names.
138.It Cm check Op Ar pkg ...
139Use this command to check the files belonging to some or all of the
140packages installed on the local machine against the checksum
141which was recorded in the
142.Pa +CONTENTS
143files at package installation time.
144Symbolic links also have their integrity checked against the recorded
145value at package installation time.
146If no additional argument is given, the files of all installed packages
147are checked, else only the named packages will be checked (wildcards can
148be used here, see
149.Xr pkg_info 1 ) .
150.Pp
151The packages'
152.Pa +CONTENTS
153files will be parsed and the
154checksum will be checked for every file found.
155A warning message is printed if the expected checksum differs from the
156checksum of the file on disk.
157Symbolic links are also checked, ensuring that the targets on disk are
158the same as the contents recorded at package installation time.
159.It Cm check-license Ar condition
160Check if
161.Ar condition
162can be fulfilled with the currently set of accepted licenses.
163Prints either yes or no to stdout if the condition can be parsed,
164otherwise it exits with error.
165.It Cm check-pkg-vulnerabilities Oo Fl s Oc Ar file
166Check format and hashes in the pkg-vulnerabilities file
167.Ar file .
168If
169.Fl s
170is given, also check the embedded signature.
171.It Cm check-signature Ar file ...
172Reports if
173.Ar file
174is a correctly signed package.
175.It Cm check-single-license Ar license
176Check if
177.Ar license
178is a valid license name and if it is in the set of acceptable licenses.
179Prints either yes or no to stdout if the condition can be parsed,
180otherwise it exits with error.
181.It Cm config-var Ar variable
182Print the current value of
183.Ar variable
184as used after parsing the configuration file.
185.It Cm delete Ar pkg ...
186For each listed package, remove all file entries in the package database that
187belong to the package.
188This should be used only by
189.Xr pkg_view 1 .
190.It Cm dump
191Dump the contents of the package database, similar to
192.Cm pkg_info -F .
193Columns are printed for the key field used in the pkgdb - the filename -,
194and the data field - the package the file belongs to.
195.It Cm fetch-pkg-vulnerabilities Oo Fl su Oc
196Fetch a new pkg-vulnerabilities file, check the format and if
197.Fl s
198is given the signature.
199If all checks are passed, write it to pkgdb.
200If
201.Fl u
202is given, the fetch is conditional and the file transfer is only done if
203the remote version is newer than the one in pkgdb.
204.It Cm findbest Ar pattern ...
205Search the entries of
206.Dv PKG_PATH
207for packages matching
208.Ar pattern .
209Print the URL of the best matching package to stdout for each pattern.
210If a pattern is not matched, it is skipped and the command will return
211a failure.
212.It Cm lsall Ar /dir/pkgpattern
213.It Cm lsbest Ar /dir/pkgpattern
214List all/best package matching pattern in the given directory
215.Pa /dir .
216If the
217.Fl d
218flag is given, then that directory path overrides
219.Pa /dir .
220Can be used to work around limitations of /bin/sh and other
221filename globbing mechanisms.
222This option implements matching of
223pkg-wildcards against arbitrary files and directories, useful mainly in
224the build system itself.
225See
226.Xr pkg_info 1
227for a description of the pattern.
228.Pp
229Example:
230.Bd -literal
231yui# cd /usr/pkgsrc/packages/i386ELF/All/
232yui# ls unzip*
233unzip-5.40.tgz  unzip-5.41.tgz
234yui# pkg_admin lsall 'unzip*'
235/usr/pkgsrc/packages/i386ELF/All/unzip-5.40.tgz
236/usr/pkgsrc/packages/i386ELF/All/unzip-5.41.tgz
237yui# pkg_admin lsall 'unzip\*[Ge]5.40'
238/usr/pkgsrc/packages/i386ELF/All/unzip-5.40.tgz
239/usr/pkgsrc/packages/i386ELF/All/unzip-5.41.tgz
240yui# pkg_admin lsall 'unzip\*[Ge]5.41'
241/usr/pkgsrc/packages/i386ELF/All/unzip-5.41.tgz
242yui# pkg_admin lsbest 'unzip\*[Ge]5.40'
243/usr/pkgsrc/packages/i386ELF/All/unzip-5.41.tgz
244yui# pkg_admin lsall /usr/pkgsrc/packages/i386ELF/All/'{mit,unproven}-pthread*'
245/usr/pkgsrc/packages/i386ELF/All/mit-pthreads-1.60b6.tgz
246/usr/pkgsrc/packages/i386ELF/All/unproven-pthreads-0.15.tgz
247.Ed
248.It Cm pmatch Ar pattern Ar pkg
249Returns true if
250.Ar pkg
251matches
252.Ar pattern ,
253otherwise returns false.
254.It Cm rebuild
255Rebuild the package database mapping from scratch.
256This option is only intended for recovery after system crashes
257during package installation and removal.
258.It Cm rebuild-tree
259Rebuild the +REQUIRED_BY files from scratch by reresolving all dependencies.
260.Pp
261This option is intended to be used for fixing inconsistencies between
262the records of depending and depended-on packages, such as can arise
263by the use of
264.Cm pkg_delete -f .
265.It Cm set Ar variable=value pkg ...
266Set variable with information about the installed package.
267Use
268.Cm unset
269to remove a variable.
270.Pp
271Packages that are not installed directly by the user but pulled in as
272dependencies are marked by setting
273.Dq automatic=YES .
274.It Cm gpg-sign-package pkg spkg
275Sign the binary package
276.Ar pkg
277using GPG and write the result to
278.Ar spkg .
279.It Cm x509-sign-package pkg spkg key cert
280Sign the binary package
281.Ar pkg
282using the key
283.Ar key
284and the certificate
285.Ar cert ,
286using
287.Ar spkg
288as output file.
289.It Cm unset Ar variable pkg ...
290Remove an installation variable.
291.El
292.Sh ENVIRONMENT
293See
294.Xr pkg_install.conf 5
295for options, that can also be specified using the environment.
296.Sh FILES
297.Bl -tag -width /var/db/pkg/pkgdb.byfile.db -compact
298.It Pa /var/db/pkg/pkgdb.byfile.db
299.It Pa /var/db/pkg/\*[Lt]pkg\*[Gt]/+CONTENTS
300.El
301.Sh SEE ALSO
302.Xr pkg_add 1 ,
303.Xr pkg_create 1 ,
304.Xr pkg_delete 1 ,
305.Xr pkg_info 1 ,
306.Xr pkg_view 1 ,
307.Xr pkg_install.conf 5 ,
308.Xr pkgsrc 7
309.Sh HISTORY
310The
311.Nm
312command first appeared in
313.Nx 1.4 .
314.Sh AUTHORS
315The
316.Nm
317command was written by Hubert Feyrer.
318