1.\" $NetBSD: pkg_admin.1,v 1.1.1.11 2010/06/26 00:14: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 June 16, 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, override the 122.Dv CHECK_END_OF_LIFE 123option from 124.Xr pkg_install.conf 5 125with 126.Qq Li yes . 127If 128.Fl s 129is given, check the signature of the pkg-vulnerabilities file before using it. 130.Fl t 131restricts the reported vulnerabilities to type 132.Ar type . 133.It Cm audit-pkg Oo Fl es Oc Oo Fl t Ar type Oc Oo Ar pkg Oc ... 134Like 135.Cm audit , 136but check only the given package names or patterns. 137.It Cm audit-batch Oo Fl es Oc Oo Fl t Ar type Oc Oo Ar pkg-list Oc ... 138Like 139.Cm audit-pkg , 140but read the package names or patterns one per line from the given files. 141.It Cm audit-history Oo Fl s Oc Oo Fl t Ar type Oc Oo Ar pkgbase Oc ... 142Print all vulnerabilities for the given base package names. 143.It Cm check Op Ar pkg ... 144Use this command to check the files belonging to some or all of the 145packages installed on the local machine against the checksum 146which was recorded in the 147.Pa +CONTENTS 148files at package installation time. 149Symbolic links also have their integrity checked against the recorded 150value at package installation time. 151If no additional argument is given, the files of all installed packages 152are checked, else only the named packages will be checked (wildcards can 153be used here, see 154.Xr pkg_info 1 ) . 155.Pp 156The packages' 157.Pa +CONTENTS 158files will be parsed and the 159checksum will be checked for every file found. 160A warning message is printed if the expected checksum differs from the 161checksum of the file on disk. 162Symbolic links are also checked, ensuring that the targets on disk are 163the same as the contents recorded at package installation time. 164.It Cm check-license Ar condition 165Check if 166.Ar condition 167can be fulfilled with the currently set of accepted licenses. 168Prints either yes or no to stdout if the condition can be parsed, 169otherwise it exits with error. 170.It Cm check-pkg-vulnerabilities Oo Fl s Oc Ar file 171Check format and hashes in the pkg-vulnerabilities file 172.Ar file . 173If 174.Fl s 175is given, also check the embedded signature. 176.It Cm check-signature Ar file ... 177Reports if 178.Ar file 179is a correctly signed package. 180.It Cm check-single-license Ar license 181Check if 182.Ar license 183is a valid license name and if it is in the set of acceptable licenses. 184Prints either yes or no to stdout if the condition can be parsed, 185otherwise it exits with error. 186.It Cm config-var Ar variable 187Print the current value of 188.Ar variable 189as used after parsing the configuration file. 190.It Cm delete Ar pkg ... 191For each listed package, remove all file entries in the package database that 192belong to the package. 193This should be used only by 194.Xr pkg_view 1 . 195.It Cm dump 196Dump the contents of the package database, similar to 197.Cm pkg_info -F . 198Columns are printed for the key field used in the pkgdb - the filename -, 199and the data field - the package the file belongs to. 200.It Cm fetch-pkg-vulnerabilities Oo Fl su Oc 201Fetch a new pkg-vulnerabilities file, check the format and if 202.Fl s 203is given the signature. 204If all checks are passed, write it to pkgdb. 205If 206.Fl u 207is given, the fetch is conditional and the file transfer is only done if 208the remote version is newer than the one in pkgdb. 209.It Cm findbest Ar pattern ... 210Search the entries of 211.Dv PKG_PATH 212for packages matching 213.Ar pattern . 214Print the URL of the best matching package to stdout for each pattern. 215If a pattern is not matched, it is skipped and the command will return 216a failure. 217.It Cm lsall Ar /dir/pkgpattern 218.It Cm lsbest Ar /dir/pkgpattern 219List all/best package matching pattern in the given directory 220.Pa /dir . 221If the 222.Fl d 223flag is given, then that directory path overrides 224.Pa /dir . 225Can be used to work around limitations of /bin/sh and other 226filename globbing mechanisms. 227This option implements matching of 228pkg-wildcards against arbitrary files and directories, useful mainly in 229the build system itself. 230See 231.Xr pkg_info 1 232for a description of the pattern. 233.Pp 234Example: 235.Bd -literal 236yui# cd /usr/pkgsrc/packages/i386ELF/All/ 237yui# ls unzip* 238unzip-5.40.tgz unzip-5.41.tgz 239yui# pkg_admin lsall 'unzip*' 240/usr/pkgsrc/packages/i386ELF/All/unzip-5.40.tgz 241/usr/pkgsrc/packages/i386ELF/All/unzip-5.41.tgz 242yui# pkg_admin lsall 'unzip\*[Ge]5.40' 243/usr/pkgsrc/packages/i386ELF/All/unzip-5.40.tgz 244/usr/pkgsrc/packages/i386ELF/All/unzip-5.41.tgz 245yui# pkg_admin lsall 'unzip\*[Ge]5.41' 246/usr/pkgsrc/packages/i386ELF/All/unzip-5.41.tgz 247yui# pkg_admin lsbest 'unzip\*[Ge]5.40' 248/usr/pkgsrc/packages/i386ELF/All/unzip-5.41.tgz 249yui# pkg_admin lsall /usr/pkgsrc/packages/i386ELF/All/'{mit,unproven}-pthread*' 250/usr/pkgsrc/packages/i386ELF/All/mit-pthreads-1.60b6.tgz 251/usr/pkgsrc/packages/i386ELF/All/unproven-pthreads-0.15.tgz 252.Ed 253.It Cm pmatch Ar pattern Ar pkg 254Returns true if 255.Ar pkg 256matches 257.Ar pattern , 258otherwise returns false. 259.It Cm rebuild 260Rebuild the package database mapping from scratch. 261This option is only intended for recovery after system crashes 262during package installation and removal. 263.It Cm rebuild-tree 264Rebuild the +REQUIRED_BY files from scratch by reresolving all dependencies. 265.Pp 266This option is intended to be used for fixing inconsistencies between 267the records of depending and depended-on packages, such as can arise 268by the use of 269.Cm pkg_delete -f . 270.It Cm set Ar variable=value pkg ... 271Set variable with information about the installed package. 272Use 273.Cm unset 274to remove a variable. 275.Pp 276Packages that are not installed directly by the user but pulled in as 277dependencies are marked by setting 278.Dq automatic=YES . 279.It Cm gpg-sign-package pkg spkg 280Sign the binary package 281.Ar pkg 282using GPG and write the result to 283.Ar spkg . 284.It Cm x509-sign-package pkg spkg key cert 285Sign the binary package 286.Ar pkg 287using the key 288.Ar key 289and the certificate 290.Ar cert , 291using 292.Ar spkg 293as output file. 294.It Cm unset Ar variable pkg ... 295Remove an installation variable. 296.El 297.Sh ENVIRONMENT 298See 299.Xr pkg_install.conf 5 300for options, that can also be specified using the environment. 301.Sh FILES 302.Bl -tag -width /var/db/pkg/pkgdb.byfile.db -compact 303.It Pa /var/db/pkg/pkgdb.byfile.db 304.It Pa /var/db/pkg/\*[Lt]pkg\*[Gt]/+CONTENTS 305.El 306.Sh SEE ALSO 307.Xr pkg_add 1 , 308.Xr pkg_create 1 , 309.Xr pkg_delete 1 , 310.Xr pkg_info 1 , 311.Xr pkg_view 1 , 312.Xr pkg_install.conf 5 , 313.Xr pkgsrc 7 314.Sh HISTORY 315The 316.Nm 317command first appeared in 318.Nx 1.4 . 319.Sh AUTHORS 320The 321.Nm 322command was written by Hubert Feyrer. 323