PKG.ADD

install or upgrade a package

Synopsis

pkg.add [ -u ] [ -f ] [ -r root ] [ -c config ]

package.pkg.tar.*

Description

pkg.add installs a binary package archive into the system. It reads the package database, checks for conflicts, extracts files, and updates the database. The installation sequence is:
1. Parse archive (name, version, file list)
2. Check for conflicts with installed packages
3. Load install rules from pkg.add.conf(5)
4. Extract metadata — create groups/users (before extraction)
5. Extract archive to root
6. Remove orphaned files (on upgrade)
7. Update package database
8. Run ldconfig and triggers
9. Apply file permissions from metadata
10. Apply file capabilities from metadata
Groups and users declared in the package metadata are created

before

file extraction so that files can reference the correct ownership. Services are

not

automatically enabled on install — the symlink is not created by pkg.add.

Options

-u, --upgrade
Upgrade an existing package. Files present in the old version but absent in the new one are removed. Configuration files matched by pkg.add.conf(5) UPGRADE rules are preserved.
-f, --force
Force installation, overwriting files that conflict with other installed packages.
-r root, --root root
Install to an alternative root directory.
-c config, --config config
Use an alternative configuration file instead of /etc/pkg.add.conf .

Package Metadata

If the package contains a metadata file at var/lib/pkg/meta/ , pkg.add processes the following directives:
group entry
Create a system group (and optionally a user). See MAKEPKG(5) for the entry format.
permission entry
Apply ownership and mode to a file after extraction. Format: /path:owner:group:mode .
capability entry
Apply file capabilities after extraction using setcap (8). Format: /path:capabilities . Requires libcap to be installed on the system. If setcap is not found, a warning is printed and the entry is skipped.

Triggers

After extraction, pkg.add runs cache-regeneration triggers based on installed file paths:
usr/share/fonts/            → fc-cache -s
usr/share/glib-2.0/schemas/ → glib-compile-schemas
usr/lib/gdk-pixbuf-2.0/     → gdk-pixbuf-query-loaders
usr/share/mime/             → update-mime-database
usr/share/icons/            → gtk-update-icon-cache
usr/share/applications/     → update-desktop-database
Triggers fire at most once per install regardless of how many files match. If the trigger command is not installed, it is silently skipped.

Environment

PKG_ROOT
Alternative installation root (same as -r ).
PKG_DBDIR
Override the package database directory. Default: /var/lib/pkg .
TMPDIR
Temporary directory for metadata extraction. Default: /tmp .

Files

__IBLOCK__/var/lib/pkg/db
Package database.
__IBLOCK__/var/lib/pkg/meta/
Per-package metadata files.
__IBLOCK__/etc/pkg.add.conf
Installation rules. See pkg.add.conf(5).

Exit Status

0 on success, 1 on error.

See Also

Pure LLVM musl libc Source-Based Independent