The pkg-inst tool is part of the
pkgutils suite. It is used to install and upgrade a
package. In the architecture directory of the CD distribution is a
package database file named "pkg-db.xml " that drives
pkg-inst . The package database file contains information
about all packages in the directory it resides in and what
dependencies each package has. With this knowledge,
pkg-inst is able to install and upgrade packages
regardless of the underlying package management system.
General usage for pkg-inst is:
$ pkg-inst --depot=[depot]
[packages ...]
Multiple depot directories can be specified, with each expected
to contain either a "pkg-db.xml " file and/or a
"depot-db.xml " file. The "depot-db.xml " file
contains information about subdirectories that are to be descended
into to search for additional "depot-db.xml " and
"pkg-db.xml " files. Because of this file, it is possible
for pkg-inst to recursively descend into directories to
search for packages. By default, pkg-inst will descend
into all subdirectories listed in the "depot-db.xml "
file. The --update-type option can be used to restrict
where pkg-inst packages are searched. The general layout
of a depot is:
[depot]/cd/depot-db.xml
[depot]/cd/dists/depot-db.xml
[depot]/cd/dists/7.0
[depot]/cd/dists/7.0/depot-db.xml
[depot]/cd/dists/7.0/errata/
[depot]/cd/dists/7.0/errata/depot-db.xml
[depot]/cd/dists/7.0/errata/sparc-sun-solaris2.8/
[depot]/cd/dists/7.0/errata/sparc-sun-solaris2.8/pkg-db.xml
By default, all subpackage components of a package will be
installed. When dependencies are required for a package and the
"--ignoredeps " option is not given, only those subpackage
components needed to meet the dependency will be installed.
The following is a quick example of how much easier package
installation is with pkg-inst . It is a sample run of the
installation of GNU zip (gzip) on Solaris. Examples using the native
package management system are given in the chapters to follow
describing how to install, remove, and updates packages using the
native package management system. Comparing the two, it should be easy
to see how much simpler pkg-inst makes the installation
process.
$ pkg-inst --depot=/tmp/depot gzip
gzip
depot containing v1.3.5-1 of this package ...
file:///tmp/depot
checking if already installed ... no
components to install: TWWgzp13m, TWWgzp13u, TWWgzp13d
checking for dependencies ... none
installing TWWgzp13m ...
$ pkgadd -a /opt/TWWfsw/pkgutils15/share/pkgadd/admin -d
/opt/dist/cd/TWWgzp13m TWWgzp13m
...
updating package database entry for man fileset ... done
installing TWWgzp13u ...
$ pkgadd -a /opt/TWWfsw/pkgutils15/share/pkgadd/admin -d
/opt/dist/cd/TWWgzp13u TWWgzp13u
...
updating package database entry for runtime fileset ... done
installing TWWgzp13d ...
$ pkgadd -a /opt/TWWfsw/pkgutils15/share/pkgadd/admin -d
/opt/dist/cd/TWWgzp13d TWWgzp13d
...
updating package database entry for doc fileset ... done
The following command can be used to install the latest
versions of all packages in a depot. However, it will not necessarily
install all packages in the depot. If more than one version of a
package is present in the depot (e.g. Tcl 8.0, 8.1, and 8.2) only the
latest version will be installed (e.g. Tcl 8.2).
$ pkg-inst
--depot=[depot]
When upgrading to a new release, it might not be desirable to
install all packages. Rather, it might be more desirable to install
only newer versions of those packages are already installed. The
"--match-target " option, with the appropriate argument,
will install only those packages in the depot that are already
installed on the target. Thus, if the current version of Tcl on the
target is 8.0.4 and the depot contains both Tcl 8.0.5 and Tcl 8.1.1,
the following command will install only the 8.0.5 version whereas the
above command would have installed both the 8.0.5 and 8.1.1
versions:
$ pkg-inst
--match-target=package --depot=[depot] tcl
To upgrade to the latest version of tcl, use
"--match-target=name ". In the case above, if the target
contains Tcl 8.0.5 and Tcl 8.0.5 and Tcl 8.1.1 are available, v8.1.1
would be installed with:
$ pkg-inst --match-target=name
--depot=[depot] tcl
The "--match-target=package " option matches
against an installed package instance, what the package manager knows
the name of the package as. In the case of Tcl 8.0.4, for
Solaris/pkgadd this is "TWWtcl80 ". With the
"--match-target=name " option, pkg-inst bases
the upgrade on what it knows the package name as. In the case of Tcl
8.0.4, 8.0.5, and 8.1.1, the name is "tcl ".
The "--remove-prev-ver " option will remove older
versions of all packages installed by pkg-inst , providing
the older version is not a dependency for another package. It does
this by building a running list of successfully installed packages,
determining the previous versions using the global
pkg-db.xml file, and then invoking pkg-rm to
remove the packages (without the "--add-inverse-deps "
option). This method has the side effect of requiring more disk space
because, if upgrading from 3.2 to 3.3, all 3.2 and 3.3 packages will
be installed before package deletion begins. Because
pkg-inst must wait until all packages are installed to
determine which were successfully installed, just-in-time deletion of
older packages cannot be performed because a package selected for
installation but not yet installed might be dependent on an older
version of an already-installed package.
For each subpackage installed, an entry is written to a package
database directory specified with the
--pkg-db=path entry. Files in the database
directory are named after the installed package and in XML format,
similar to the "pkg-db.xml " file. These files are updated
as packages are installed, updated, and removed. The default path for
the package database is /var/opt/TWWfsw/pkgutils15 . Special
considerations must be taken with the database path for RPM packages.
If a package is installed and removed without the pkg-rm
command, pkg-inst will fail with the following warning
(this warning is ignored if --reinstall is given):
installing [package] ...
A pkg-db entry for this package already exists. This should not
occur. Maybe the pkg-db entry is corrupt? Please check
/var/opt/TWWfsw/pkgutils15/jpeg-6b.
To create files in the new package database for packages
installed with a previous release, use the pkg-info
command with the "--update-pkg-db " option.
$ ls -ld /var/opt/TWWfsw/pkgutils15/python-2.1.2
/var/opt/TWWfsw/pkgutils15/python-2.1.2: No such file or directory
$ pkg-info --update-pkg-db --verbose
...
python
checking if v2.1.2 installed (TWW.python212) ... yes
installed instances ... TWW.python212.man TWW.python212.doc
TWW.python212.rte TWW.python212.pkg
updating package database entry for man fileset ... done
updating package database entry for doc fileset ... done
updating package database entry for runtime fileset ... done
updating package database entry for packages fileset ... done
...
$ ls -ld /var/opt/TWWfsw/pkgutils15/python-2.1.2
-rw-r--r-- 1 root system 839 May 17 00:23 python-2.1.2
Extracting native package from .pkg-inst archive
The "--extract=path " option is available to
copy the raw package out of the .pkg-inst archive to a
local directory. The pkg-inst(1) man page documents this
option and how the package is copied to the destination directory.
Installing RPM packages
pkg-inst needs no assistance when installing
packages for the native package management systems. However, if
installing RPM packages for multiple platforms on the same host, the
default database path, "/var/opt/TWWfsw/rpm40/lib/rpm " will not
be sufficient. A separate database directory must exist for each
platform. The following options are of particular importance:
--rpm-arch=<arch> RPM architecture type. Possible types are:
alpha (Tru64 UNIX 4.x, 5.x)
i386 (Redhat Linux, RHEL/x86)
ia64 (HP-UX 11.x/IA)
mipseb (IRIX 6.x)
parisc (HP-UX 10.20, 11.x/PA)
ppc (AIX 4.3.x, 5.x)
sparc (Solaris 2.x)
x86_64 (RHEL/x86_64)
--rpm-db=<dir> RPM database path
If installing for a non-native architecture, the
"--rpm-arch=arch " option specifies which platform
to install for. This is important because, by default,
pkg-inst will select a default architecture name (from
the list above) based on the host platform pkg-inst is
running on. Because the RPM package name contains the architecture
type, pkg-inst must know the correct architecture type to
select the correct RPM file. The examples below demonstrate the
pkg-inst equivalent commands for each of the RPM
commands.
$ rpm -Uv --dbpath /var/rpm/sparc-sun-solaris2.8 --relocate \
/opt/TWWfsw=/nfs/sparc-sun-solaris2.8 --ignorearch --ignoreos \
/tmp/solaris2.8-rpms/TWWtin-1.4.2-1.sparc.rpm
$ pkg-inst --rpm-db=/var/rpm/sparc-sun-solaris2.8 -e --relocate
-e /opt/TWWfsw=/nfs/sparc-sun-solaris2.8 -e --ignorearch -e --ignoreos
--depot=/tmp/solaris2.8-rpms tin
$ rpm -Uv --dbpath /var/rpm/sparc-sun-solaris2.6 --relocate \
/opt/TWWfsw=/nfs/sparc-sun-solaris2.6 --ignorearch --ignoreos \
/tmp/solaris2.6-rpms/TWWtin-1.4.2-1.sparc.rpm
$ pkg-inst --rpm-db=/var/rpm/sparc-sun-solaris2.6 -e --relocate
-e /opt/TWWfsw=/nfs/sparc-sun-solaris2.6 -e --ignorearch -e --ignoreos
--depot=/tmp/solaris2.6-rpms tin
$ rpm -Uv /tmp/solaris2.8-rpms/TWWtin-1.4.2-1.sparc.rpm
$ pkg-inst --depot=/tmp/solaris2.8-rpms tin
Installing packages from a remote repository
In addition to installing packages from a local repository, a
remote repository, available through the HTTP protocol,
can be used. A package format has been created for use with
pkg-inst . Filenames ending with ".pkg-inst "
contain the binaries in Zip archive format and filenames ending with
".pkg-inst.md5 " contain the MD5 checksum of the
".pkg-inst " archive. The following options to
pkg-inst are of importance:
--dist=<dist> Name of distribution to update. Default
value is "cd" for the normal distribution.
Used mainly when installing from a
remote depot.
--local-depot=<depot> Path to local repository to store
files retrieved from remote repositories
--login=<login> Login for remote depot
--password=<pass> Password for remote depot
--proxy-host=<host:port> Hostname and proxy of proxy server
--proxy-login=<login> Login for proxy server
--proxy-password=<pass> Password to proxy server
--update-type=<type> Limit updates to . Possible types are:
errata packages security support updates
Default type is "packages". Used mainly
when installing from a remote depot.
To install remote packages, a local repository must be created
to save the downloaded packages. This directory is specified with the
"--local-depot=depot " option.
pkg-inst will create a temporary working directory to
extract the ".pkg-inst " files when working (usually in
"/var/tmp ").
Installation from a remote depot is similar to installation
from a local depot. As with the local depot,
--depot=depot specifies the location of the depot.
If the target is behind a firewall, the
--proxy-host=host:port ,
--proxy-login=login , and
--proxy-password=password options can be used to
penetrate the firewall. If a login and password are required for
authentication to the depot, the --login=login and
--password=password options must be used. HTTP
BASIC authentication is used for authentication to remote depots. The
--update-type=type option specifies which
directory in the depot to install packages from. If not specified and
the base of the remote depot contains a "depot-db.xml "
file, the directories specified in the "depot-db.xml "
file are searched for packages. The "--verbose " option to
pkg-inst provides information about what directories are
being searched. All packages from our quarterly distribution are
available in the "packages " directory
("--update-type=packages "). Updates made available
between releases will be available from the "errata ",
"security ", and "updates " directories.
As pkg-inst installs packages from a remote depot,
it populates the local depot (specified with
"--local-depot=depot ") with the
".pkg-inst " package files. These files are never removed
by "pkg-inst ". If the packages in the remote depot are
updated after the copies are made to the local depot,
pkg-inst will check the remote depot for updates and
download newer versions of the packages. If future installs or
reinstallations are necessary, the local depot can be specified as the
depot for the "--depot=depot " option to eliminate
the download time. It is also possible to mirror the remote repository
to local disk and specify the local mirror directory as the depot to
pkg-inst .
Once the ".pkg-inst " file is downloaded,
pkg-inst will verify the file against its MD5 signature,
unpack the archive and the archive"s contents, and proceed with
installation. If the MD5 signature check fails, pkg-inst
will re-download the package and proceed to unpack the archive for
installation.
The following is a sample run under HP-UX installing MGv, the
postscript previewer:
$ pkg-inst --dist-ver=5.1 --local-depot=/tmp/pkg --login=[login]
--password=[password] --depot=http://updates.thewrittenword.com mgv
mgv
depot containing v3.1.5-2 of this package ...
http://updates.thewrittenword.com
checking if already installed ... no
components to install: TWWmgv.TWWmgv-MAN, TWWmgv.TWWmgv-RUN
checking for dependencies ... yes
TWWxpm.TWWxpm-RUN (v>=3.4k, r>=1) ... to be installed
reordering packages ...
adding TWWxpm.TWWxpm-RUN [xpm] (v>=3.4k, r>=1) to package list
found v3.4k-3 in depot http://updates.thewrittenword.com
will reinstall after dependencies installed
xpm
depot containing v3.4k-3 of this package ...
http://updates.thewrittenword.com
checking if already installed ... no
components to install: TWWxpm.TWWxpm-RUN
checking for dependencies ... none
checking if package exists in local depot ... no
retrieving xpm-3.4k-3 package from remote depot ... 100%
verifying MD5 checksum of retrieved package payload ... ok
extracting package files ...
extracting data.zip file ... done
testing data.zip ... done
unpacking data.zip contents ... done
installing TWWxpm.TWWxpm-RUN ...
$ swinstall -s /var/tmp/AAAa26293/TWWxpm.depot TWWxpm.TWWxpm-RUN
...
updating package database entry for runtime fileset ... done
removing temporary files ... done
mgv
depot containing v3.1.5-2 of this package ...
http://updates.thewrittenword.com
checking if already installed ... no
components to install: TWWmgv.TWWmgv-MAN, TWWmgv.TWWmgv-RUN
checking for dependencies ... yes
TWWxpm.TWWxpm-RUN (v>=3.4k, r>=1) ... to be installed
reordering packages ...
skipping TWWxpm.TWWxpm-RUN as installation already attempted
checking if package exists in local depot ... no
retrieving mgv-3.1.5-2 package from remote depot ... 100%
verifying MD5 checksum of retrieved package payload ... ok
extracting package files ...
extracting data.zip file ... done
testing data.zip ... done
unpacking data.zip contents ... done
installing TWWmgv.TWWmgv-MAN ...
$ swinstall -s /var/tmp/BAAa26293/TWWmgv.depot TWWmgv.TWWmgv-MAN
...
updating package database entry for man fileset ... done
installing TWWmgv.TWWmgv-RUN ...
$ swinstall -s /var/tmp/BAAa26293/TWWmgv.depot TWWmgv.TWWmgv-RUN
...
updating package database entry for runtime fileset ... done
removing temporary files ... done
Checking GPG signature of packages
Packages are signed with our GPG key. The
"--check-sig " option checks the signature of the package
against our GPG public key in your keyring (specified with
"--gpg-keyring-path=path "). Before running
pkg-inst with "--check-sig ", the
"gpg " binary must be available in your search path
($PATH ). The "gpg " binary is available from
the GnuPG package. Our GPG public key is available online
and in the "support " directory of our distribution CDs
under the name "public-key.gpg ". The following
demonstrates how to import our public key into a keyring:
$ gpg --no-default-keyring --homedir <keyring path> --import tww-public-key.gpg
gpg: key FE93BD4E:public key imported
gpg: Total number processed: 1
gpg: imported: 1
$ gpg --no-default-keyring --homedir <keyring path> --list-keys
<keyring path>/pubring.gpg
------------------------------
pub 1024D/FE93BD4E 2001-04-08 The Written Word, Inc. <security@thewrittenword.com>
sub 2048g/87A9A2F0 2001-04-08
The following is a sample run under HP-UX installing Xpm with
the --check-sig option to check its GPG signature.
$ pkg-inst --check-sig --gpg-keyring-path=/root/tww-gpg --dist-ver=6.1
--local-depot=/tmp/pkg --login=[login] --password=[password]
--depot=http://updates.thewrittenword.com xpm
xpm
depot containing v3.4k-3 of this package ...
http://updates.thewrittenword.com
checking if already installed ... no
components to install: TWWxpm.TWWxpm-MAN, TWWxpm.TWWxpm-RUN
checking for dependencies ... none
checking if package exists in local depot ... no
retrieving xpm-3.4k-3 package from remote depot ... 100%
verifying MD5 checksum of retrieved package payload ... ok
verifying GPG signature of retrieved package payload ... ok
extracting package files ...
extracting data.zip file ... done
testing data.zip ... done
unpacking data.zip contents ... done
installing TWWxpm.TWWxpm-MAN ...
$ swinstall -s /var/tmp/AAAa26284/TWWxpm.depot TWWxpm.TWWxpm-MAN
...
updating package database entry for man fileset ... done
installing TWWxpm.TWWxpm-RUN ...
$ swinstall -s /var/tmp/AAAa26284/TWWxpm.depot TWWxpm.TWWxpm-RUN
...
updating package database entry for runtime fileset ... done
removing temporary files ... done
Configuration file
A configuration file can be created to help reduce the number
of options on the command-line. The location of the configuration file
is "/opt/TWWfsw/pkgutils15/etc/pkgutils.conf ". The default
version installed with pkgutils contains verbose descriptions of all
options. The configuration file is also documented in
pkgutils.conf(4) .
A sample configuration file to retrieve packages from the
latest distribution would look like:
local-depot = "/tmp/pkg"
depots = [ http://updates.thewrittenword.com ]
pkg-db = "/var/opt/TWWfsw/pkgutils15"
depot http://updates.thewrittenword.com {
dist-ver = [ latest ]
login =
password =
}
Without the configuration file above, the command-line
equivalent for pkg-inst would be:
$ pkg-inst --local-depot=/tmp/pkg --dist-ver=latest --login=
--password= --depot=http://updates.thewrittenword.com
With the configuration file, the above would be reduced to
executing:
$ pkg-inst
Inside pkg-inst
Local and remove repositories
When specifying a repository with the
"--depot=depot " option, the distribution name,
specified with the "--dist=dist " option, must
exist as a subdirectory of the repository path. Thus, if
pkg-inst is invoked as:
$ pkg-inst --dist-ver=6.1 --depot=http://updates.thewrittenword.com ...
the root path of the repository is
"http://updates.thewrittenword.com/cd " where a
"depot-db.xml " or "pkg-db.xml " file is
expected to reside. If pkg-inst is invoked as:
$ pkg-inst --dist-ver=6.1 --dist=local \
--depot=http://updates.thewrittenword.com ...
the root path of the repository is
"http://updates.thewrittenword.com/local ".
In the repository root, pkg-inst searches for
either the "depot-db.xml " or "pkg-db.xml "
file. Unlike a remote repository, raw packages can reside in the same
directory as the "pkg-db.xml " file while with remote
repositories, ".pkg-inst " package files must reside in
the same directory as their corresponding "pkg-db.xml "
file.
The depot-db.xml file
As indicated previously, pkg-inst can recursively
descend into a repository to search for packages. This is done using
the "depot-db.xml " file. pkg-inst expects to
find either a "depot-db.xml " or "pkg-db.xml "
at the root of a repository and at each directory it descends into.
The "depot-db.xml " file contains a list of directories to
recurse into. Therefore, pkg-inst will recurse into the
depot to the directory level specified by "depot-db.xml ".
The DTD of the "depot-db.xml " file is documented in
depot-db.xml(4) in the pkgutils package.
The pkg-db.xml file
The pkg-inst tool is simply a front-end to the
native package management systems. It contains pluggable backend
modules for each supported package manager to handle calls to the
native package management system. To unify the differences between the
different package management systems and provide a single interface to
the backend modules, the "pkg-db.xml " file was created
which provides all the information pkg-inst needs to
install and remove a package. The "pkg-db.xml " file is at
the heart of all utilities in the pkgutils suite. The DTD
of the "pkg-db.xml " file is documented in
pkg-db.xml(4) .
|