DragonFly On-Line Manual Pages
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 vari-
ant 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 cur-
rently installed, on the basis that a correctly initialised sys-
tem 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 proto-
col 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 dependen-
cies and are not required any more.
backup Dump the local package database to a file specified on the com-
mand-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.
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 success-
fully fetched.
lock Prevent modification or deletion of a package.
plugins
List the available plugins.
query Query information about installed packages.
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 to do all manipulation 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
SEE ALSO
SBUF(9), elf(3), fetch(3), libarchive(3), pkg_printf(3), pkg_repos(3),
pkg-repository(5), pkg.conf(5), pkg-add(8), pkg-annotate(8),
pkg-audit(8), pkg-autoremove(8), pkg-backup(8), pkg-check(8),
pkg-clean(8), pkg-config(8), pkg-convert(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-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
ports-mgmt/poudriere
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 5.5 October 31, 2015 DragonFly 5.5
PKG-REPOSITORY(5) DragonFly File Formats Manual PKG-REPOSITORY(5)
NAME
package repository -- format and operation of package repositories used
by pkg(8).
DESCRIPTION
Package repositories used by the pkg(8) program consist of one or more
collections of ``package tarballs'' together with package catalogues and
optionally various other collected package metadata.
Each collection consists of packages suitable for installation on a spe-
cific system ABI: a combination of operating system, CPU architecture, OS
version, word size, and for certain processors endianness or similar
attributes.
The package collections are typically made available to users for down-
load via a web or FTP server although various other means of access may
be employed. Encoding the ABI value into the repository URL allows pkg
to automatically select the correct package collection by expanding the
special token ${ABI} in pkg.conf.
Repositories may be mirrored over several sites: pkg has built-in support
for discovering available mirrors dynamically given a common URL by sev-
eral mechanisms.
FILESYSTEM ORGANIZATION
Only very minimal constraints on repository layout are prescribed by pkg.
The following constraints are all that must be met:
* A repository may contain several package collections with parallel
REPOSITORY_ROOTs in order to support diverse system ABIs.
* All of the content for one ABI should be accessible in a filesystem
or URL hierarchy beneath the REPOSITORY_ROOT.
* All packages available beneath one REPOSITORY_ROOT should be binary
compatible with a specific system ABI.
* The repository catalogue is located at the apex of the repository, at
a specific location relative to the REPOSITORY_ROOT.
Package catalogues contain the paths relative to the REPOSITORY_ROOT for
each package, allowing the full URL for downloading the package to be
constructed.
Where a package may be applicable to more than one ABI (e.g., it contains
only text files) symbolic or hard links, URL mappings or other techniques
may be utilised to avoid duplication of storage.
Although no specific filesystem organization is required, the usual con-
vention (inherited from pkg-install(8)) is to create a filesystem hierar-
chy thus:
$REPOSITORY_ROOT/All
One directory that contains every package available from the
repository for that ABI. Packages are stored as package tar-
balls identified by name and version. This directory may
contain several different versions of each package accumu-
lated over time, but the repository catalogue will only
record the latest version for each distinct package name.
$REPOSITORY_ROOT/Latest/
May contains symbolic links to the latest versions of pack-
ages in the All directory. Symbolic links contain a `latest
link' style name only, without version. As the whole `latest
link' concept is rendered obsolete by pkg, this will usually
contain only the pkg.txz link, used for bootstrapping pkg
itself on a new system.
$REPOSITORY_ROOT/packagesite.txz
Contains one JSON document, which is the concatenation of the
+MANIFEST files from each of the packages in the repository.
This is used by pkg-1.1 or later.
$REPOSITORY_ROOT/repo.txz
(Deprecated). Contains the package manifest data as above,
but pre-loaded into an SQLite database. This is supplied for
backwards compatibility with pkg-1.0.
$REPOSITORY_ROOT/filesite.txz
(Optional). Contains a YAML document listing all of the
files contained in all of the packages within the repository.
The repository may optionally contain sub-directories corre-
sponding to the package origins within the ports tree.
Each of the packages listed in the repository catalogue must have a
unique name. There are no other constraints: package sets are not
required to be either complete (i.e., with all dependencies satisfied) or
self-consistent within a single repository.
REPOSITORY ACCESS METHODS
pkg uses standard network protocols for repository access. Any URL
scheme understood by the fetch(3) library may be used (HTTP, HTTPS, FTP
or FILE) as well as remote access over SSH. See fetch(3) for a descrip-
tion of additional environment variables, including FETCH_BIND_ADDRESS,
FTP_LOGIN, FTP_PASSIVE_MODE, FTP_PASSWORD, FTP_PROXY, ftp_proxy,
HTTP_AUTH, HTTP_PROXY, http_proxy, HTTP_PROXY_AUTH, HTTP_REFERER,
HTTP_USER_AGENT, NETRC, NO_PROXY and no_proxy.
REPOSITORY MIRRORING
Multiple copies of a repository can be provided for resilience or to
scale up site capacity. Two schemes are provided to auto-discover sets
of mirrors given a single repository URL.
HTTP The repository URL should download a text document containing a
sequence of lines beginning with `URL:' followed by any amount of
white space and one URL for a repository mirror. Any lines not
matching this pattern are ignored. Mirrors are tried in the order
listed until a download succeeds.
SRV For an SRV mirrored repository where the URL is specified as
http://pkgrepo.example.org/ SRV records should be set up in the
DNS:
$ORIGIN example.com
_http._tcp.pkgrepo IN SRV 10 1 80 mirror0
IN SRV 20 1 80 mirror1
where the SRV priority and weight parameters are used to control
search order and traffic weighting between sites, and the port num-
ber and hostname are used to construct the individual mirror URLs.
Mirrored repositories are assumed to have identical content, and only one
copy of the repository catalogue will be downloaded to apply to all mir-
ror sites.
WORKING WITH MULTIPLE REPOSITORIES
Where several different repositories are configured pkg will search
amongst them all in the order specified by the PRIORITY settings in the
repo.conf files, unless directed to use a single repository by the -r
flag to pkg-fetch(8), pkg-install(8), pkg-upgrade(8), pkg-search(8) or
pkg-rquery(8).
Where several different versions of the same package are available, pkg
will select the one with the highest version to install or to upgrade an
installed package to, even if a lower numbered version can be found in a
repository earlier in the list. This applies even if an explicit version
is stated on the command line. Thus if packages example-1.0.0 and
example-1.0.1 are available in configured repositories, then
pkg install example-1.0.0
will actually result in example-1.0.1 being installed. To override this
behaviour, on first installation of the package select the repository
with the appropriate version:
pkg install -r repo-a example-1.0.0
and then to make updates to that package ``sticky'' to the same reposi-
tory, set the value CONSERVATIVE_UPGRADE to true in pkg.conf.
SEE ALSO
fetch(3), pkg_printf(3), pkg_repos(3), pkg.conf(5), pkg(8), pkg-add(8),
pkg-annotate(8), pkg-audit(8), pkg-autoremove(8), pkg-backup(8),
pkg-check(8), pkg-clean(8), pkg-config(8), pkg-convert(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-update(8), pkg-updating(8), pkg-upgrade(8), pkg-version(8),
pkg-which(8)
DragonFly 5.5 February 1, 2015 DragonFly 5.5