Software Distributor Administration Guide (March 2009)

Table Of Contents
11.5.1 Details Common to All Control Scripts
The agent runs as the superuser, therefore control scripts are always executed as
the superuser. Use appropriate caution.
Control scripts are only executed for software being installed, removed or verified
in the primary root (“/”) or an alternate root directory. Scripts are never executed
for software in a depot.
Each script must set its own PATH variable, using SW_PATH.
Neither swinstall nor swremove require that the system be shut down. Control
scripts must work correctly on both quiet single-user systems and active multi-user
systems. They must deal properly with unremovable running programs. They
might have to shut down or start up processes that they own themselves to succeed.
Control scripts can be re-executed. If a script is run more than once, it should
produce the same results each time. The second execution should not produce any
error messages or leave the system in a state different than before it was run.
A script should be executable after its fileset was loaded without damaging the
new fileset with which it is associated.
For example, if you must copy a file from under /usr/newconfig to another
location, use the cpio -p command to copy it rather than the cp command to
move it, or check for the absence of the /usr/newconfig version before
attempting the move. (The cpio(1) command may be preferred over cp(1) because
cpio copies the mode, owner, and group permissions.)
Control scripts can exit with one of the following return values:
SUCCESS (0) - Exit with no errors or warnings.
ERROR (1) - Exit with serious errors.
WARNINGS (2) - Exit with warnings.
REBOOT (12) -Exits and indicates that a reboot of the system is required when
a fileset is installed. This return value is only valid for checkinstall and
checkremove scripts for a fileset that includes a dynamic_module attribute.
All messages produced by control scripts are redirected to the agent logfile.
The set of control scripts executed during a particular phase of a task are always
executed in prerequisite order the scripts of each prerequisite product/fileset are
executed before the script of the dependent fileset.
All control scripts are readable by any other control script.
11.5.2 Checkinstall Scripts
Checkinstall scripts are executed during the Analysis phase of a swinstall
session. The pathname of the script being executed is:
$ {SW_CONTROL_DIRECTORY}checkinstall
A checkinstall script must not modify the system.
278 Using Control Scripts