Software Distributor Administration Guide for HP-UX 11i
Using Control Scripts
Execution of Control Scripts
Chapter 11 387
Execution of Control Scripts
This section details how each control script is executed.
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 must exit with a return value of zero (exit 0) if no
serious errors occur (no error or warning messages printed, as
described in the “Control Script Input and Output” on page 397.)
They must return 1 (exit 1) in case of any serious errors, and 2
(exit 2) for warnings.
All messages produced by control scripts are redirected to the agent
logfile.