Making Packages Remotely Installable
All packages must be installable remotely. Installable remotely means you do not assume
the administrator installing your package is installing to the root (/) file system
of the system running the pkgadd command. If, in one of your procedure scripts,
you need to get to the /etc/vfstab file of the target system, you
need to use the PKG_INSTALL_ROOT environment variable. In other words, the path name
/etc/vfstab will get you to the /etc/vfstab file of the system running the pkgadd
command, but the administrator may be installing to a client at /export/root/client3. The
path ${PKG_INSTALL_ROOT}/etc/vfstab is guaranteed to get you to the target file system.
Example – Installing to a Client System
In this example, the SUNWstuf package is installed to client3, which is configured
with /opt in its root (/) file system. One other version of
this package is already installed on client3, and the base directory is set
to basedir=/opt/$PKGINST from an administration file, thisadmin. (For more information on administration files, see
The Administrative Defaults File.) The pkgadd command executed on the server is:
# pkgadd -a thisadmin -R /export/root/client3 SUNWstuf
The table below lists the environment variables and their values that are passed
to the procedure scripts.
Table 6-1 Values Passed to Procedure Scripts
Environment Variable |
Value |
PKGINST |
SUNWstuf.2 |
PKG_INSTALL_ROOT |
/export/root/client3 |
CLIENT_BASEDIR |
/opt/SUNWstuf.2 |
BASEDIR |
/export/root/client3/opt/SUNWstuf.2 |
Example – Installing to a Server or Standalone System
To install to the server or a standalone system under the same circumstances
as the previous example, the command is:
# pkgadd -a thisadmin SUNWstuf
The table below lists the environment variables and their values that are passed
to the procedure scripts.
Table 6-2 Values Passed to Procedure Scripts
Environment Variable |
Value |
PKGINST |
SUNWstuf.2 |
PKG_INSTALL_ROOT |
Not defined. |
CLIENT_BASEDIR |
/opt/SUNWstuf.2 |
BASEDIR |
/opt/SUNWstuf.2 |
Example – Mounting Shared File Systems
Assume that the SUNWstuf package creates and shares a file system on the
server at /export/SUNWstuf/share. When the package is installed to the client systems,
their /etc/vfstab files need to be updated to mount this shared file system.
This is a situation where you can use the CLIENT_BASEDIR variable.
The entry on the client needs to present the mount point with
reference to the client's file system. This line should be constructed correctly whether the
installation is from the server or from the client. Assume that the
server's system name is $SERVER. You can go to $PKG_INSTALL_ROOT/etc/vfstab and, using the
sed or awk commands, construct the following line for the client's /etc/vfstab file.
$SERVER:/export/SUNWstuf/share - $CLIENT_BASEDIR/usr nfs - yes ro
For example, for the server universe and the client system client9, the line
in the client system's /etc/vfstab file would look like:
universe:/export/SUNWstuf/share - /opt/SUNWstuf.2/usr nfs - yes ro
Using these parameters correctly, the entry always mounts the client's file system, whether
it is being constructed locally or from the server.