Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
Software Distributor Administration Guide: HP-UX 11i v1, 11i v2, and 11i v3 > Chapter 11 Using Control Scripts

Using Environment Variables

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Glossary

 » Index

All control scripts are invoked as the superuser and executed by the agent process. HP-UX provides environment variables that affect SD-UX commands and scripts. These variables fall are catgorized as follows:

  • Variables that affect all SD-UX commands.

  • Variables that affect all SD-UX scripts.

  • Variables that affect swinstall and swremove.

Variables That Affect All SD-UX Commands

LANG

  • This external variable applies to all SD commands except install-sd.

  • Determines the language in which messages are displayed. If LANG is not specified or is set to the empty string, a default value of “C” is used.

  • The language in which the SD agent and daemon log messages are displayed is set by the system configuration variable script, /etc/rc.config.d/LANG. For example, /etc/rc.config.d/LANG must be set to “LANG=ja_JP.SJIS” or “LANG=ja_JP.eucJP” to make the agent and daemon log messages display in Japanese.

    You may also use the export LANG= command.

  • See the lang(5) man page for more information.

LC_ALL

  • Determines the locale used to override any values for locale categories specified by the settings of LANG or any environment variables beginning with LC_.

LC_CTYPE

  • Determines the interpretation of sequences of bytes of text data as characters (e.g., single-versus multibyte characters in values for vendor-defined attributes).

LC_MESSAGES

  • Determines the language in which messages should be written.

LC_TIME

  • Determines the format of dates (create_date and mod_date) when displayed by swlist. Used by all utilities when displaying dates and times in stdout, stderr, and logging.

TZ

  • Determines the time zone for use when displaying dates and times.

Variables That Affect All SD-UX Scripts

SW_CATALOG

  • Holds the path to the Installed Products Database (IPD), relative to the path in the SW_ROOT_DIRECTORY environment variable. (You can specify a path for the IPD using the installed_software_catalog default option.)

SW_CONTROL_DIRECTORY

  • Defines the full pathname to the directory containing the script. This tells other scripts where other control scripts for the software are located (subscripts, for example).

    Also contains the response file generated by a request script. Other scripts that reference the response file access the file by referencing this variable.

    The directory is either a temporary catalog directory, or a directory within in the Installed Products Database (IPD).

    Here is an example of sourcing:

    . ${SW_CONTROL_DIRECTORY}subscript grep something ${SW_CONTROL_DIRECTORY}datafile

SW_CONTROL_TAG

  • Holds the tag name of the control_file being executed. When packaging software, you can define a physical name and path for a control file in a depot. This lets you define the control_file with a name other than its tag and lets you use multiple control_file definitions to point to the same file. A control_file can query the SW_CONTROL_TAG variable to determine which tag is being executed.

SW_LOCATION

  • Defines the location of the product, which may have been changed from the default product directory (if the product is locatable).

    When installing to (or removing from) the primary root directory (“/”), this variable is the absolute path to the product directory. For operations on an alternate root directory, the variable must be prefixed by SW_ROOT_DIRECTORY to correctly reference product files.

    If a product is not locatable, then the value of SW_LOCATION will always be the default product directory defined when the product is packaged.

SW_PATH

  • The search path for commands. A PATH variable defines the minimum set of commands available for use in a control script (for example, /sbin:/usr/bin:/usr/ccs/sbin).

    A control script should always set its own PATH variable, and the PATH variable must begin with $SW.PATH. The PATH should be set as follows:

    PATH=$SW_PATH

    export PATH

    Additional directories, like /usr/local/bin, can be appended to PATH, but you must make sure that the commands in those directories exist.

SW_ROOT_DIRECTORY

  • Defines the root directory in which the session is operating, either “/” or an alternate root directory. This variable tells control scripts the root directory in which the products are installed. A script must use this directory as a prefix to SW_LOCATION to locate the product’s installed files.

    All control scripts (except for the configure and unconfigure scripts) can be executed during an install or remove task on an alternate root. If the scripts reference any product files, each reference must include the {SW_ROOT_DIRECTORY} in the file pathname.

    The scripts may only need to perform actions when installing to (removing from) the primary root directory (“/”). If so, then the SW_ROOT_DIRECTORY can be used to cause a simple exit 0 when the task is operating in an alternate root directory:

    if test "${SW_ROOT_DIRECTORY}" != "/" then      exit 0 fi

SW_SESSION_OPTIONS

  • Contains the pathname of a file containing the value of every option for a particular command, including software and target selections. This lets scripts retrieve any command options and values other than the ones provided explicitly by other environment variables.

SW_SOFTWARE_SPEC

  • Contains the fully qualified software specification of the current product or fileset. The software specification allows the product or fileset to be uniquely identified. (Fully qualified software specs include the r=, a=, and v= version components even if they contain empty strings. For installed software, l= must also be included.)

Variables That Affect swinstall and swremove

SW_DEFERRED_KERNBLD

  • This variable is normally unset. If it is set, the actions necessary for preparing the system file /stand/system cannot be accomplished from within the postinstall scripts, but instead must be accomplished by the configure scripts. This occurs whenever software is installed to a directory other than root(/).

  • This variable should be read only by the configure and postinstall scripts of a kernel fileset.

SW_INITIAL_INSTALL

  • This variable is normally unset. If it is set, the swinstall session is being run as the back end of an initial system software installation (that is, a “cold” install).

SW_KERNEL_PATH

  • The path to the kernel. The default value is /stand/vmunix.

SW_SESSION_IS_KERNEL

  • Indicates whether a kernel build is scheduled for the current install/remove session.

  • A “true” value indicates that the selected kernel fileset is scheduled for a kernel build and that changes to /stand/system are required.

  • A null value indicates that a kernel build is not scheduled and that changes to /stand/system are not required.

  • The value of this variable is always equal to the value of SW_SESSION_IS_REBOOT.

SW_SESSION_IS_REBOOT

  • Indicates whether a reboot is scheduled for a fileset selected for removal. Because all HP-UX kernel filesets are also reboot filesets, the values of this variables is always equal to the value of SW_SESSION_IS_KERNEL.

SW_SYSTEM_FILE_PATH

  • The path to the kernel’s system file. The default value is /stand/system.

Variables That Affect swverify

SW_IS_COMPATIBLE

  • Designed to help you determine if installed software is incompatible and should be removed from a system.

  • For use during the execution of a verify script, which is called by the swverify command.

  • The variable will be set to true if the software being considered is compatible with the system on which it is installed.

  • Set to false if the software being considered incompatible with the system on which it is installed.

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1997, 2000-2003, 2006, 2007, 2008 Hewlett-Packard Development Company, L.P.