Packaging your software applications

3. Placing objects into classes

Installation classes allow a series of actions to be performed on a group of package objects at the time of their installation or removal. You place objects into a class in the prototype(F) file. All package objects must be given a class, although the class of none can be used for objects that require no special action.

The installation parameter CLASSES, defined in the pkginfo(F) file, is a list of classes to be installed (including the none class). Objects defined in the prototype file that belong to a class not listed in this parameter will not be installed. The actions to be performed on a class (other than simply copying the components to the installation machine) are defined in a class action script. These scripts are named after the class itself.

For example, to define and install a group of objects belonging to a class named class1, follow these steps:

  1. Define the objects belonging to class1 as such in their prototype(F) file entry. For example:
       f class1 /usr/src/myfile
       f class1 /usr/src/myfile2

  2. Ensure that the CLASSES parameter in the pkginfo(F) file has an entry for class1. For example:
       CLASSES="class1 class2 none"

    NOTE: Package objects cannot be removed by class.

  3. Ensure that a class action script exists for this class. An installation script for a class named class1 would be named i.class1 and a removal script would be named r.class1.

    If you define a class but do not deliver a class action script, the only action taken for that class will be to copy components from the installation medium to the installation machine.

In addition to the classes that you can define, the system provides three standard classes for your use. The sed class provides a method for using sed instructions to edit files upon package installation and removal. The awk class provides a method for using awk instructions to edit files upon package installation and removal. The build class provides a method to construct a file dynamically during package installation.
Next topic: 4. Making package objects relocatable
Previous topic: Accessing the instance identifier in your scripts

© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005