Since the apk_add command may execute scripts or programs contained within 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.
The following command line arguments are supported:
apkname
Specify a full package file, a package name with version, a package
name without version, or a
full URI. Packages (that
are not local pkgfiles) will be fetched
from APK_PATH. If a full URI is
supplied, dependencies are also fetched from
the same site.
-dDon't install any dependecies.
-fForce installation to proceed even if prerequisite packages are not installed or the requirements script fails. Although apk_add will still try to find and auto-install missing prerequisite packages, a failure to find one will not be fatal.
-hShow help and exit.
-IDon't execute any installation scripts (pre-update, pre-install, post-install or post-update).
-nDon't actually install a package, just report the steps that would be taken if it was.
-p prefixSet prefix as the directory in which to extract files from a package.
-qQuiet mode. Supress non-error messages.
-sDon't verify the checksum of the package against the index.
-uUpdate already installed packages.
-vTurn on verbose output.
If the apkname is not a file in the local file
system and the package is not already
installed, the apk_add utility will fetch the package
to the $ROOT/var/cache/packages directory and verify the checksum.
The apk_add utility then runs through the following
sequence to install a package:
Create a unique temporary directory in /usr/tmp, unpack
the package and create
the $ROOT/var/db/apk/pkgname-ver/CONTENTS file
where pkgname-ver is the package
name (with version) in question.
Remove a downloaded package if $APK_KEEPCACHE is
not set.
Scan all the package dependencies. If any of these required packages is not currently installed, an attempt is made to find and install it; if the missing package cannot be found or installed, the installation is terminated.
If the package is an update for an already installed
package and it contains a pre-update file, it
is then executed as
sh pre-update pkgname-ver pkgname-oldver
where pkgname-ver is the package
name (with version) in question
and pkgname-oldver is the currently
installed version of the package.
If the pre-update script fails, installation
terminates.
If the package contains a pre-install file, it
is then executed as
sh pre-install pkgname-ver
where pkgname-ver is the package
name (with version) in question
and pkgname-oldver is the currently
installed version of the package.
If the pre-install script fails, installation
terminates.
Register or update all config files in
the $ROOT/var/lib/apk/default.tdb sfic database
of the package.
The config files are defined by the $APK_LBUDIRS envirnoment
variable or /etc/apk.conf keyword.
Merge the files extracted to /usr/tmp into
$ROOT. This is done by parsing the temporary
directory and moving files and directories
to $ROOT.
Create
the $ROOT/var/db/apk/pkgname-ver/CONTENTS file
where pkgname-ver is the package
name (with version) in question.
Any dependencies are recorded or updated in the other
packages' REQUIRED_BY list.
If the package contains a post-install file, it
is then executed as
sh var/db/apk/pkgname-ver/post-install pkgname-ver
where pkgname-ver is the package
name (with version) in question.
If package is an update, then remove all files that exist in the old
packages' CONTENTS list but not in the
new CONTENTS list.
Remove also the old packages' meta
data, the $ROOT/var/db/apk/pkgname-ver.tar.gz file.
If package is an update and contains a post-update file, it
is then executed as
sh var/db/apk/pkgname-ver/post-update pkgname-ver pkgname-oldver
where pkgname-ver is the package
name (with version) in question
and pkgname-oldver is the old version of the package.
Finally the $ROOT/var/db/apk/ directory
is compressed to pkgname-ver$ROOT/var/db/apk/pkgname-ver.tar.gz
and the temporay directory and the $ROOT/var/db/apk/pkgname-ver directory are deleted.
APK_ADD_TMP
Directory where apk_add stores
temporary files. Default is /usr/tmp.
APK_CACHE
Alternative location for the cached index file.
Default is $ROOT/var/lib/apk.
APK_DBDIR
Alternative location for the installed package database.
Default is $ROOT/var/db/apk.
APK_KEEPCACHEDownloaded files will not be deleted if this is set to "yes".
APK_PATHList of URI's to remote package repository mirrors. The URI's are separated by a semicolon (;).
APKTOOLS_CONF
Configuration file for the apk-tools suite.
Default is /etc/apk.conf.
PACKAGES
Base directory where apk_add saves downloaded
packages. Default is $ROOT/var/cache/packages.
$ROOT/var/cache/packagesDefault location to save downloaded files into.
$ROOT/var/db/apkDefault location for the installed package database.
$ROOT/var/lib/apk/INDEX.sha1.gzThe cached index file.
$ROOT/var/lib/apk/default.tdbThe sfic database that contains the default config files' status.
/etc/apk.confDefault location of the apk-tools configuration file.
/usr/tmpDefault location for temporary files and directories.