Application Packaging Developer's Guide

Using the BASEDIR Parameter

The pkginfo file for any relocatable package must include a default base directory in the form of an entry like this:


BASEDIR=absolute_path

This is only the default base directory; it can be changed by the administrator during installation.

While some packages require more than one base directory, the advantage to using this parameter to position the package is because the base directory is guaranteed to be in place and writable as a valid directory by the time installation begins. The correct path to the base directory for the server and client is available to all procedure scripts in the form of reserved environment variables, and the pkginfo -r SUNWstuf command displays the current installation base for the package.

In the checkinstall script, BASEDIR is the parameter exactly as defined in the pkginfo file (it has not been conditioned yet). In order to inspect the target base directory, the ${PKG_INSTALL_ROOT}$BASEDIR construction is required. This means that the request or checkinstall script can change the value of BASEDIR in the installation environment with predictable results. By the time the preinstall script is called, the BASEDIR parameter is the fully conditioned pointer to the actual base directory on the target system, even if the system is a client.


Note -

The request script utilizes the BASEDIR parameter differently for different releases of the SunOS operating system. In order to test a BASEDIR parameter in a request script, the following code should be used to determine the actual base directory in use.

# request script
constructs base directory
if [ ${CLIENT_BASEDIR} ]; then
	  LOCAL_BASE=$BASEDIR
else
	  LOCAL_BASE=${PKG_INSTALL_ROOT}$BASEDIR
fi