pkgadd Command

Purpose

Transfers a software package or set to the system.

Syntax

To Install a Software Package
pkgadd [ -d Device] [ -r Response] [ -n ] [ -a Admin] [ -P Path ] [ Pkginst1 [ Pkginst2 [. . .]]]
To Copy a Software Package to the Specified Spool Directory
pkgadd -s Spool [ -d Device] [ Pkginst1 [ Pkginst2 [. . .]]]

Description

pkgadd Transfers the contents of a software package or set from the distribution medium or directory to install it onto the system. A package is a collection of related files and executables that can be independently installed. A set is made up of a special-purpose package, referred to as a Set Installation Package (SIP), and a collection of one or more packages that are members of the set. The SIP controls the installation of the set.

pkgadd Checks that all packages listed on the command line are on the installation medium. If any of the packages that are listed do not exist, no changes are made to the system, that is, none of the listed packages are installed.
Note: Nonroot users must meet the following conditions to run the pkgadd command successfully:
  1. Users must have write permission to the paths specified in the pkgmap file.
  2. The current user:group must match the user:group specified in the pkgmap file.
  3. Users must have write permissions on the /var/sadm/install and /var/sadm/pkg directories.

Used without the -d flag, pkgadd looks in the default spool directory for the package (/var/spool/pkg). Used with the -s flag, it writes the package to a spool directory instead of installing it.

Error messages are always logged. In addition, when pkgadd terminates, it sends mail (by default, to root) with all the error messages and a summary of which packages installed completely, partially, or not at all.

Flags

Table 1. Flags
Item Description
-d Device Installs or copies a package or set from Device. Device can be the full pathname to a directory, file or named pipe, or - which specifies packages in datastream format that is read from standard input. The default device is the installation spool directory (/var/spool/pkg).
-r Response Identifies a file or directory, Response, which contains the answers to questions posed by a request script during a previous pkgask session conducted in interactive mode [see the pkgask command]. When Pkginst is a package, Response can be a full pathname or a directory; when Pkginst is a SIP, Response must be a directory.
-n Specifies that installation runs in non-interactive mode. The default mode is interactive.
-a Admin Defines an installation administration file Admin, to be used in place of the default administration file to specify whether installation checks (such as the check on the amount of space, the system state) are done. The token none overrides the use of any admin file, and thus forces interaction with the user. Unless a full pathname is given, pkgadd looks in the /var/sadm/install/admin directory for the file. By default, the file default in that directory is used. default specifies that no checking is done, except to see whether there is enough room to install the package and if there are dependencies on other packages. The -a flag cannot be used if Pkginst is a SIP.
-P Path Specifies an alternative root directory path for installation. Files are installed under this location.
Pkginst Defines a short string that is used to designate an abbreviation for the package or set name. (The term package instance is used loosely: It refers to all instantiations of Pkginst.) See the pkginfo command and the pkginfo file format.

If Pkginst is a SIP, the SIP controls installation of the set by using request scripts and preinstall scripts. The SIP request script, not the package installation tools, is responsible for prompting the user for responses and taking the appropriate actions. If the request script fails, only the SIP is processed.

To indicate all instances of a package, specify 'Pkginst.*', enclosing the command line in single quotation marks, as shown, to prevent the shell from interpreting the * character. Use the token "all" to refer to all packages available on the source medium.

-s Spool Reads the package into the directory Spool instead of installing it.
Special Notes

The -r flag can be used to indicate a directory name and a filename. The directory can contain numerous Response files, each sharing the name of the package with which it must be associated. This can be used, for example, when adding multiple interactive packages with one invocation of pkgadd. Each package that had a request script need a Response file. If you create response files with the same name as the package (for example, Package1 and Package2) then, after the -r flag, name the directory in which these files reside.

The -n flag causes the installation to halt if any interaction is needed to complete it.

When invoked with no Pkginst specified on the command line, pkgadd displays the names of sets if at least one SIP exists on the media. Because of this, you shouldn't include packages on the same media if some are members of sets, and some are not. If you do, the packages, which are not members of the sets can be installed only if their pkginst names are provided on the command line.

The pkgadd command checks to see whether any of the files in Pkginst are already installed on the system and, if any are, saves this fact before continuing with installation. Later, pkgadd does not reinstall these files on the system. If one of the package installation scripts removes such a file, the result is that the file will no longer be on the system when package installation completes.

The pkgadd command does not uncompress any files that were already compressed (that is, only those in .Z form) before being processed by pkgmk.

Exit Status

This command returns the following exit values:
Table 2. Exit Status
Item Description
0 Successful completion of script.
1 Fatal error. The installation process is terminated at this point.
2 Warning or possible error condition. Installation continues. A warning message is displayed at the time of completion.
3 The script was interrupted and possibly left unfinished. Installation terminates.
4 The script was suspended (administration). Installation terminates.
5 Script was suspended (no interaction was required). Installation terminates.
10 The system must be rebooted when installation of all selected packages is completed. (This value must be added to one of the single-digit exit codes described above.)
20 The system should be rebooted immediately upon completing installation of the current package. (This value must be added to one of the single-digit exit codes described above.)
77 No package was selected for the set.
99 Internal error.

Files

Table 3. Files
Item Description
/var/sadm/install/admin/default Default package administration file
/var/sadm/install/logs/pkginst.log error message log
/var/spool/pkg Default spool directory