PKG_ADMIN(1)

NAME
pkg_admin - perform various administrative tasks to the pkg system

SYNOPSIS
pkg_admin [-V] [-K pkg_dbdir] [-s sfx_pattern] command [args ...]

DESCRIPTION
This command performs various administrative tasks around the NetBSD Packages System.

OPTIONS
The following command-line options are supported:

-b  Print only the basenames when matching package names for lsall and lsbest.

-d lsdir
    Set lsdir as the path to the directory in which to find matching package names for lsall and lsbest.

-K pkg_dbdir
    Set pkg_dbdir as the package database directory. If this option isn't specified, then the package database directory is taken from the value of the environment variable PKG_DBDIR if it's set, otherwise it defaults to /var/db/pkg.

-S  Set the shell glob pattern for package suffices when matching package names for lsall and lsbest to be the null suffix. The default pattern is ".t[bg]z".

-s sfx_pattern
    Set the shell glob pattern for package suffices when matching package names for lsall and lsbest. The default pattern is ".t[bg]z".

-V  Print version number and exit.

The following commands are supported:

add pkg ...
    For each listed package, write the absolute pathnames of the files listed in its +CONTENTS file together with the package they belong to into the package database. This should be used only by pkg_view(1).

check [pkg ...]
    Use this command to check the files belonging to some or all of the packages installed on the local machine against their MD5 checksum noted in their +CONTENTS files. If no additional argument is given, the files of all installed packages are checked, else only the named packages will be checked (wildcards can be used here, see pkg_info(1)).

    The packages' +CONTENTS files will be parsed and the MD5 checksum will be checked for every file found. A warning message is printed if the expected checksum differs from the checksum of the file on disk.

delete pkg ...
    For each listed package, remove all file entries in the package database that belong to the package. This should be used only by pkg_view(1).

dump
    Dump the contents of the package database, similar to pkg_info -F. Columns are printed for the keyfield used in the pkgdb - the filename -, and the data field - the package the file belongs to.

lsall /dir/pkgpattern

lsbest /dir/pkgpattern
    List all/best package matching pattern in the given directory /dir. If the -d flag is given, then that directory path overrides /dir. Can be used to work around limitations of /bin/sh and other filename globbing mechanisms. This option implements matching of pkg-wildcards against arbitrary files and directories, useful mainly in the build system itself. See pkg_info(1) for a description of the pattern.

    Example:

        yui# cd /usr/pkgsrc/packages/i386ELF/All/
        yui# ls unzip*
        unzip-5.40.tgz  unzip-5.41.tgz
        yui# pkg_admin lsall 'unzip*'
        /usr/pkgsrc/packages/i386ELF/All/unzip-5.40.tgz
        /usr/pkgsrc/packages/i386ELF/All/unzip-5.41.tgz
        yui# pkg_admin lsall 'unzip5.40'
        /usr/pkgsrc/packages/i386ELF/All/unzip-5.40.tgz
        /usr/pkgsrc/packages/i386ELF/All/unzip-5.41.tgz
        yui# pkg_admin lsall 'unzip5.41'
        /usr/pkgsrc/packages/i386ELF/All/unzip-5.41.tgz
        yui# pkg_admin lsbest 'unzip5.40'
        /usr/pkgsrc/packages/i386ELF/All/unzip-5.41.tgz
        yui# pkg_admin lsall /usr/pkgsrc/packages/i386ELF/All/'{mit,unproven}-pthread*'
        /usr/pkgsrc/packages/i386ELF/All/mit-pthreads-1.60b6.tgz
        /usr/pkgsrc/packages/i386ELF/All/unproven-pthreads-0.15.tgz

pmatch pattern pkg
    Returns true if pkg matches pattern, otherwise returns false.

rebuild
    Rebuild the package database mapping from scratch, scanning subdirectories in /var/db/pkg for +CONTENTS files, parsing them and writing the resulting absolute pathnames together with the package they belong to into the package database.

    This option is intended to be used for upgrading from non-pkgdb-pkg_* tools to pkgdb-pkg_* tools, further manipulation of the pkgdb will be done by pkg_add(1), pkg_delete(1), and pkg_create(1).

    Needs to be run as root.

ENVIRONMENT
PKG_DBDIR
    If the -K flag isn't given, then PKG_DBDIR is the location of the package database directory. The default package database directory is /var/db/pkg.

FILES
/var/db/pkg/pkgdb.byfile.db
/var/db/pkg/pkg/+CONTENTS

SEE ALSO
pkg_add(1), pkg_create(1), pkg_delete(1), pkg_info(1), pkg_view(1), packages(7)

HISTORY
The pkg_admin command first appeared in NetBSD 1.4.

AUTHORS
The pkg_admin command was written by Hubert Feyrer.