PKG_VIEW(1)

NAME
pkg_view - add and delete instances of depoted packages in views

SYNOPSIS
pkg_view [-nVv] [-d stowdir] [-i ignore] [-k pkg_dbdir] [-W viewbase] [-w view] command package ...

DESCRIPTION
The pkg_view command is used to add and delete instances of depoted packages in stowdir in a view in the viewbase directory.

WARNING
Since the pkg_view command may execute scripts or programs provided by a package file, your system may be susceptible to “Trojan horses” or other subtle attacks from miscreants who create dangerous package files.

You are advised to verify the competence and identity of those who provide installable package files. For extra protection, examine all the package control files in the package database directory (/usr/pkg/packages/pkg-name/). Pay particular attention to any +INSTALL, +DEINSTALL, +REQUIRE, or +MTREE_DIRS files, and inspect the +CONTENTS file for @cwd, @mode (check for setuid), @dirrm, @exec, and @unexec directives, and/or use the pkg_info(1) command to examine the installed package control files.

OPTIONS
The following command-line options are supported:

-d stowdir
    Set stowdir as the directory in which the depoted packages can be found. If this option isn't specified, then the stowdir is taken from the value of the environment variable DEPOTBASE if it's set, otherwise the default stowdir is the path to the packages directory under viewbase.

-i ignore
    Add ignore to the list of files in package that should ignored when adding or removing the package instance from view.

-k pkg_dbdir
    Set pkg_dbdir as the package database directory for the default (empty) view. If this option isn't specified, then the package database directory is taken from the value of the environment variable PKG_DBDIR, otherwise it defaults to /var/db/pkg.

-n  Don't actually execute the commands for manipulating the package instances.

-V  Print the version number and exit.

-v  Turn on verbose output. Specifying -v multiple times increases the level of verbosity.

-W viewbase
    Set viewbase as the directory in which all the views are managed. The default viewbase directory is /usr/pkg but may be overridden by the LOCALBASE environment variable.

-w view
    Set view as the directory in viewbase in which the package instances should be added or deleted. The default view is the empty view but may be overridden by the PKG_VIEW environment variable.

The following commands are supported:

add Add the listed package instances into view.

check
    Check whether the listed package instances are present in view. If they are not present, then return 0, otherwise return 1.

delete
    Delete the listed package instances from view.

ENVIRONMENT

DEPOTBASE
    This is the location of the stowdir directory inside which all depoted packages are kept. The default stowdir is the packages directory under viewbase.

LOCALBASE
    This is the location of the viewbase directory in which all the views are managed. The default viewbase directory is /usr/pkg.

PKG_DBDIR
    If the -k flag isn't given, then the value of the environment variable PKG_DBDIR is the package database directory for the default view, otherwise it defaults to /var/db/pkg.

PLIST_IGNORE_FILES
    This can be used to specify files in package that should ignored when adding or removing the package instance from view. PLIST_IGNORE_FILES is a space-separated list of shell glob patterns that match files relative to the package depot directory, and it defaults to "info/dir *[~#] *.OLD *.orig *,v". This is overridden by any _PLIST_IGNORE_FILES setting in a package's build-info-file (see pkg_create(1)) if it exists.

PKG_VIEW
    The default view can be specified in the PKG_VIEW environment variable.

FILES

pkg-dbdir/package/+INSTALL
    If the package contains an install script (see pkg_create(1)), then after the package instance is added into a view, the script is executed with the following arguments:

    package
        The name of the package instance being added.

    VIEW-INSTALL
        Keyword denoting that the script is to perform any actions needed after the package instance is added to a view.

    If the install script exits with a non-zero status code, the installation is terminated.

pkg-dbdir/package/+DEINSTALL
    If the package contains an deinstall script (see pkg_create(1)), then before the package instance is deleted from a view, the script is executed with the following arguments:

    package
        The name of the package instance being deleted.

    VIEW-DEINSTALL
        Keyword denoting that the script is to perform any actions needed before the package instance is deleted from a view.

    If the deinstall script exits with a non-zero status code, the de-installation is terminated.

The install and deinstall scripts are called with the environment variable PKG_PREFIX set to the path to the view directory.

SEE ALSO
linkfarm(1), pkg_delete(1)

AUTHORS
The pkg_view utility was written by Alistair G. Crooks <agc@NetBSD.org>.