Software Distributor Administration Guide HP-UX 11i v1, 11i v2, and 11i v3 (5900-2561, March 2013)
11.1.1.3 Control Script Format
A control script should be a shell script (as opposed to a binary) and written to be interpreted by
the Posix.2 shell /sbin/sh. Korn shell (formerly /bin/ksh) syntax is acceptable to the Posix.2
shell. A script written for csh is not supported.
The script should have a simple header similar to the example below. Included in the header should
also be comment lines which state the product and fileset to which the script belongs, the name of
the script, the revision string as required by the what(1) command, and a simple copyright statement.
#! /sbin/sh
########
# Product: <PRODUCT>
# Fileset: <FILESET>
# configure
# @(#) $Revision: 1.1 $
########
#
# (c) Copyright MyCompany, 2001
#
########
11.2 General Script Guidelines
Here are some guidelines for writing control scripts:
• Consider doing most control script work within the configure script.
• All scripts are executed serially and directly impact the total time required to complete an
installation, configuration, or removal task. Consider the impact control scripts will have on
performance.
• The current working directory in which the agent executes a control script is not defined. Use
the environment variables provided by the agent for all pathname references.
• Disk space analysis does not account for files created, copied or removed by control scripts.
• The control scripts you write may be executed several times (for example, configure, then
unconfigure, then configure...) so they must be able to support multiple executions.
• You may have to re-execute or debug control scripts, especially when they generate error or
warning conditions, so your scripts should be well-written and commented.
• Control script stdout and stderr are both logged, so you should restrict output to only the
information the user requires.
• Make sure you specify the path to a shell that is proper for your system. If you get the following
message when you execute a script:
Cannot execute /var/adm/sw/products/PRODUCT/FILESET/
configure. Bad file number (9).
it means the shell in your script has a path that is not correct for your system. (HP-UX 9.X scripts
= #!/bin/sh and HP-UX 10.X and 11.X scripts = #!/sbin/sh.)
11.3 Packaging Control Scripts
The following table describes the control script keywords for use in a PSF.
Table 50 Control Script Keywords
ExampleSize in
Bytes
TypeKeyword
/mfg/sd/scripts/checkinstall1024path_stringcheckinstall
/mfg/sd/scripts/preinstall1024path_stringpreinstall
11.2 General Script Guidelines 211