DragonFly On-Line Manual Pages

Search: Section:  


PKG(8)                 DragonFly System Manager's Manual                PKG(8)

NAME

pkg, pkg-static - manipulate packages

SYNOPSIS

pkg [-v] [-d] [-l] [-N] [-j <chroot path> | -r <root directory>] [-C <configuration file>] [-R <repository configuration directory>] [-4 | -6] <command> <flags> pkg [--version] [--debug] [--list] [-N] [--jail <jail name or id> | --chroot <chroot path> | --rootdir <root directory>] [--config <configuration file>] [--repo-conf-dir <repository configuration directory>] [-4 | -6] <command> <flags>

DESCRIPTION

pkg provides an interface for manipulating packages: registering, adding, removing and upgrading packages. pkg-static is a statically linked variant of pkg typically only used for the initial installation of pkg. There are some differences in functionality. See pkg.conf(5) for details.

OPTIONS

The following options are supported by pkg: -v, --version Display the current version of pkg. -d, --debug Show debug information. -l, --list List all the available command names, and exit without performing any other action. The -v option takes precedence over -l but -l will override any other command line arguments. -o <option=value>, --option <option=value> Set configuration option for pkg from the command line. Options that are set from the environment are redefined. It is permitted to specify this option multiple times. -N Activation status check mode. Prevent pkg from automatically creating or initializing the SQLite database in /var/db/pkg/local.sqlite if it does not already exist. Prevent pkg from performing any actions if no packages are currently installed, on the basis that a correctly initialised system using pkg will always have at least the pkg package itself registered. If used without any other arguments, pkg -N will run the sanity tests and if successful print out a short message showing how many packages are currently installed. The exit status should be a reliable indication of whether a system is configured to use pkg as its package management system or not. Example usage: if pkg -N >/dev/null 2>&1; then # pkgng-specifics else # pkg_install-specifics fi The -N flag was first released in the /usr/sbin/pkg bootstrapper in FreeBSD 8.4, but was missing from FreeBSD 9.1. It may not be enough to just call pkg -N, as the bootstrapper may be invoked, or an error returned from pkg. The following script is the safest way to detect if pkg is installed and activated: if TMPDIR=/dev/null ASSUME_ALWAYS_YES=yes \ PACKAGESITE=file:///nonexistent \ pkg info -x 'pkg(-devel)?$' >/dev/null 2>&1; then # pkgng-specifics else # pkg_install-specifics fi -c <chroot path>, --chroot <chroot path> pkg will chroot in the <chroot path> environment. -r <root directory>, --rootdir <root directory> pkg will install all packages within the specified <root directory>. -C <configuration file>, --config <configuration file> pkg will use the specified file as a configuration file. -R <repo conf dir>, --repo-conf-dir <repo conf dir> pkg will search the directory for per-repository configuration files. This overrides any value of REPOS_DIR specified in the main configuration file. -4 pkg will use IPv4 for fetching repository and packages. -6 pkg will use IPv6 for fetching repository and packages.

COMMANDS

The following commands (or their unambiguous abbreviations) are supported by pkg: help command Display usage information of the specified command. add Install a package from either a local source or a remote one. When installing from remote source you need to specify the protocol to use when fetching the package. Currently supported protocols are FTP, HTTP and HTTPS. annotate Add, modify or delete tag-value style annotations on packages. alias List the command line aliases. audit Audit installed packages against known vulnerabilities. autoremove Delete packages which were automatically installed as dependencies and are not required any more. backup Dump the local package database to a file specified on the command-line. bootstrap This is for compatibility with the pkg(7) bootstrapper. If pkg is already installed, nothing is done. If invoked with the -f flag an attempt will be made to reinstall pkg from remote repository. check Sanity checks installed packages. clean Clean the local cache of fetched remote packages. convert Convert to and from the old pkg_add(1) format. create Create a package. delete Delete a package from the database and the system. fetch Fetch packages from a remote repository. info Display information about installed packages and package files. install Install a package from a remote package repository. If a package is found in more than one remote repository, then installation happens from the first one. Downloading a package is tried from each package repository in turn, until the package is successfully fetched. lock Prevent modification or deletion of a package. plugins List the available plugins. query Query information about installed packages and package files. register Register a package in the database. repo Create a local package repository for remote usage. rquery Query information for remote repositories. search Search for the given pattern in the remote package repositories. set Modify information in the installed database. shell Open a SQLite shell to the local or remote database. Extreme care should be taken when using this command. shlib Displays which packages link to a specific shared library. stats Display package database statistics. unlock Unlocks packages, allowing them to be modified or deleted. update Update the available remote repositories as listed in pkg.conf(5). updating Display UPDATING entries of installed packages. upgrade Upgrade a package to a newer version. version Summarize installed versions of packages. which Query the database for package(s) that installed a specific file.

ENVIRONMENT

All configuration options from pkg.conf(5) can be passed as environment variables. Extra environment variables are: INSTALL_AS_USER Allow all manipulation to be done as a regular user instead of checking for root credentials when appropriate. It is expected that the user will ensure that every file and directory manipulated by pkg are readable (or writable where appropriate) by the user.

FILES

See pkg.conf(5).

EXAMPLES

Search for a package: $ pkg search perl Install a package: Installing must specify a unique origin or version otherwise it will try installing all matches. % pkg install perl-5.14 List installed packages: $ pkg info Upgrade from remote repository: % pkg upgrade Change the origin for an installed package: % pkg set -o lang/perl5.12:lang/perl5.14 % pkg install -Rf lang/perl5.14 List non-automatic packages: $ pkg query -e '%a = 0' %o List automatic packages: $ pkg query -e '%a = 1' %o Delete an installed package: % pkg delete perl-5.14 Remove unneeded dependencies: % pkg autoremove Change a package from automatic to non-automatic, which will prevent autoremove from removing it: % pkg set -A 0 perl-5.14 Change a package from non-automatic to automatic, which will make autoremove allow it be removed once nothing depends on it: % pkg set -A 1 perl-5.14 Create package file from an installed package: % pkg create -o /usr/dports/packages/All perl-5.14 Determine which package installed a file: $ pkg which /usr/local/bin/perl Audit installed packages for security advisories: $ pkg audit Check installed packages for checksum mismatches: # pkg check -s -a Check for missing dependencies: # pkg check -d -a Show the pkg-message of a package: # pkg info -D perl-5.14

SEE ALSO

pkg_create(3), pkg_printf(3), pkg_repos(3), pkg-keywords(5), pkg-lua-script(5), pkg-repository(5), pkg-script(5), pkg-triggers(5), pkg.conf(5), pkg-add(8), pkg-alias(8), pkg-annotate(8), pkg-audit(8), pkg-autoremove(8), pkg-backup(8), pkg-check(8), pkg-clean(8), pkg-config(8), pkg-create(8), pkg-delete(8), pkg-fetch(8), pkg-info(8), pkg-install(8), pkg-lock(8), pkg-query(8), pkg-register(8), pkg-repo(8), pkg-rquery(8), pkg-search(8), pkg-set(8), pkg-shell(8), pkg-shlib(8), pkg-ssh(8), pkg-stats(8), pkg-triggers(8), pkg-update(8), pkg-updating(8), pkg-upgrade(8), pkg-version(8), pkg-which(8) To build your own package set for one or multiple servers see poudriere(8) (ports/ports-mgmt/poudriere). FreeBSD pkg mirror: https://pkg.freebsd.org Your closest pkg mirror based on MaxMind GeoLite geo-DNS.

HISTORY

The pkg command first appeared in FreeBSD 9.1.

AUTHORS AND CONTRIBUTORS

Baptiste Daroussin <bapt@FreeBSD.org>, Julien Laffaye <jlaffaye@FreeBSD.org>, Philippe Pepiot <phil@philpep.org>, Will Andrews <will@FreeBSD.org>, Marin Atanasov Nikolov <dnaeon@gmail.com>, Yuri Pankov <yuri.pankov@gmail.com>, Alberto Villa <avilla@FreeBSD.org>, Brad Davis <brd@FreeBSD.org>, Matthew Seaman <matthew@FreeBSD.org>, Bryan Drewery <bryan@shatow.net>, Eitan Adler <eadler@FreeBSD.org>, Romain Tarti`ere <romain@FreeBSD.org>, Vsevolod Stakhov <vsevolod@FreeBSD.org>, Alexandre Perrin <alex@kaworu.ch>

BUGS

See the issue tracker at https://github.com/freebsd/pkg/issues. Please direct questions and issues to the pkg@FreeBSD.org mailing list. DragonFly 6.5-DEVELOPMENT June 29, 2020 DragonFly 6.5-DEVELOPMENT PKG-QUERY(8) DragonFly System Manager's Manual PKG-QUERY(8)

NAME

pkg query - query information for packages

SYNOPSIS

pkg query <query-format> <pkg-name> pkg query [-a] <query-format> pkg query -F <pkg-file> <query-format> pkg query -e <evaluation-condition> <query-format> pkg query [-Cgix] <query-format> <pattern> <...> pkg query [--all] <query-format> pkg query --file <pkg-file> <query-format> pkg query --evaluate <evaluation-condition> <query-format> pkg query [--{case-sensitive,glob,case-insensitive,regex}] <query-format> <pattern> <...>

DESCRIPTION

pkg query is used for displaying information about packages.

OPTIONS

The following options are supported by pkg query: -a, --all Match all packages from the database -C, --case-sensitive Make the standard or the regular expression (-x) matching against pkg-name case sensitive. -e, --evaluate Match packages using the given evaluation-condition. See EVALUATION FORMAT for details. -F pkg-file, --file pkg-file Display information only for the package file pkg-name. -i, --case-insensitive Make the standard or regular expression (-x) matching against pkg-name case insensitive. This is the default, unless modified by setting CASE_SENSITIVE_MATCH to true in pkg.conf. -g, --glob Treat <pattern> as a glob pattern. -x, --regex Treat <pattern> as a regular expression according to the "modern" or "extended" syntax of re_format(7).

QUERY FORMAT

There are two types of keywords for the query format: the multiline and the normal one. Only one type of multiline pattern is accepted for a given query. Normal patterns %n Name of the matched package %v Version of the matched package %o Origin of the matched package %p Prefix of the matched package %m Maintainer of the matched package %c Comment of the matched package %e Description of the matched package %w Home page of the matched package %V Returns 0 if the package is not marked as "vital", and 1 is the package is marked "vital". %l License logic of the matched package - nothing for single, & for AND, and | for OR %s[bh] The flat size of the matched package, where b is in bytes, and h is in human readable format. %a Returns 1 if the matched package was automatically installed as a dependency of another package, 0 otherwise. The package can be automatically removed via `pkg autoremove' when this flag is set and no other package depends on it. %Q Alternative architecture of the matches package %q Architecture of the matched package %k Returns 1 if the matched package is locked against modification or deletion, 0 otherwise %M message contained in the matched package %t Timestamp that the package was installed %R The name of the repository from which the package was installed if available, or "unknown-repository" otherwise. %X Internal package checksum %?[drCFODLUGBbA] Returns 0 if the list is empty and 1 if the list has information to display. d for dependencies r for reverse dependencies C for categories F for files O for options D for directories L for licenses U for users G for groups B for required shared libraries b for provided shared libraries A for annotations %#[drCFODLUGBbA] Returns the number of elements in the list d for dependencies r for reverse dependencies C for categories F for files O for options D for directories L for licenses U for users G for groups b for shared B for required shared libraries b for provided shared libraries A for annotations Multiline patterns %d[nov] Expands to the list of dependencies for the matched package, where n stands for the package name, o for the package origin, and v for the package version. %r[nov] Expands to the list of reverse dependencies for the matched package, where n stands for the package name, o for the package origin, and v for the package version. %C Expands to the list of categories the matched package belongs to. %F[ps] Expands to the list of files of the matched package, where p stands for path, and s for sum. %D Expands to the list of directories of the matched package. %O[kvdD] Expands to the list of options of the matched package, where k stands for option key, v for option value, d for option default value and D for option description. Option default values and descriptions are optional metadata and may be blank for certain packages. %L Expands to the list of license(s) for the matched package. %U Expands to the list of users needed by the matched package. %G Expands to the list of groups needed by the matched package. %B Expands to the list of shared libraries used by programs from the matched package. %b Expands to the list of shared libraries provided by the matched package. %A[tv] Expands to the list of annotations for the matched package, where t stands for the annotation tag, and v stands for the annotation value.

EVALUATION FORMAT

Packages can be selected by using expressions comparing Variables (see below) to string or integer values. The mode of comparison is specified by the Operator (also listed below). Expressions can be combined using && (for and) and || (for or). Parentheses can be used for grouping in the usual manner. String values are either any text not containing whitespace (possibly followed by but not including whitespace) or any text enclosed in single or double quotes. Variables %n Name of the package (type string) %o Origin of the package (type string) %p Prefix of the package (type string) %m Maintainer of the package (type string) %c Comment of the package (type string) %e Description of the package (type string) %w WWW address of the package (type string) %s Flatsize of the package (type integer) %a Automatic status of the package (type integer) %q Architecture of the package (type string) %k Locking status of the package (type integer) %M Message of the package (type string) %t Timestamp that the package was installed (type integer) %i Additional information about the package (type string) %#[drCFODLUGBbA] Number of elements in the list of information (type integer). See %? above for what information is used. Operators var ~ glob The string value of var matches the given glob pattern. var !~ glob The string value of var does not match the given glob pattern. var >[=] num The numerical value of var is greater than [or equal to] the given number. var <[=] num The numerical value of var is less than [or equal to] the given number. var =[=] num The numerical value of var is equal to the given number. var != num The numerical value of var is not equal to the given number.

ENVIRONMENT

The following environment variables affect the execution of pkg query. See pkg.conf(5) for further description. PKG_DBDIR CASE_SENSITIVE_MATCH

FILES

See pkg.conf(5).

EXIT STATUS

The pkg query utility exits 0 on success, and >0 if an error occurs.

EXAMPLES

List all installed packages by name-version: $ pkg query %n-%v List all dependencies for a package by origin: $ pkg query %do subversion List all dependencies by package name-version: $ pkg query %dn-%dv subversion List all reverse dependencies for a package: $ pkg query %ro perl List all files and their known checksums for a package: $ pkg query '%Fp %Fs' perl List all files for all packages: $ pkg query '%o: %Fp' List all packages with no reverse dependencies: $ pkg query -e '%#r = 0' %o List non-automatic packages: $ pkg query -e '%a = 0' %o List automatic packages: $ pkg query -e '%a = 1' %o List unmaintained packages: $ pkg query -e '%m = ports@FreeBSD.org' %o

SEE ALSO

pkg_create(3), pkg_printf(3), pkg_repos(3), pkg-keywords(5), pkg-lua-script(5), pkg-repository(5), pkg-script(5), pkg-triggers(5), pkg.conf(5), pkg(8), pkg-add(8), pkg-alias(8), pkg-annotate(8), pkg-audit(8), pkg-autoremove(8), pkg-backup(8), pkg-check(8), pkg-clean(8), pkg-config(8), pkg-create(8), pkg-delete(8), pkg-fetch(8), pkg-info(8), pkg-install(8), pkg-lock(8), pkg-register(8), pkg-repo(8), pkg-rquery(8), pkg-search(8), pkg-set(8), pkg-shell(8), pkg-shlib(8), pkg-ssh(8), pkg-stats(8), pkg-triggers(8), pkg-update(8), pkg-updating(8), pkg-upgrade(8), pkg-version(8), pkg-which(8) DragonFly 6.5-DEVELOPMENT November 18, 2016 DragonFly 6.5-DEVELOPMENT

Search: Section: