To create a database file at installation and save a copy on removal for this case study, you must complete the following tasks:
Define three classes.
The package in this case study requires the following three classes
be defined in the CLASSES
parameter:
The standard class of none, which contains a set of processes belonging in the subdirectory bin.
The admin class, which contains an executable file config and a directory containing data files.
The cfgdata class, which contains a directory.
Make the package collectively relocatable.
Notice in the prototype file that none of the path names begins with a slash or an environment variable. This indicates that they are collectively relocatable.
Calculate the amount of space the database file requires and create a space file to deliver with the package. This file notifies the pkgadd command that the package requires extra space and specifies how much.
Create a class action script for the admin class (i.admin).
The sample script initializes a database using the data files belonging to the admin class. To perform this task, it does the following:
Copies the source data file to its proper destination
Creates an empty file named config.data and assigns it to a class of cfgdata
Executes the bin/config command (delivered with the package and already installed) to populate the database file config.data using the data files belonging to the admin class
Executes the installf -f command to finalize installation of config.data
No special action is required for the admin class at removal time so no removal class action script is created. This means that all files and directories in the admin class are removed from the system.
Create a removal class action script for the cfgdata class (r.cfgdata).
The removal script makes a copy of the database file before it is deleted. No special action is required for this class at installation time, so no installation class action script is needed.
Remember that the input to a removal script is a list of path names
to remove. Path names always appear in reverse alphabetical order. This removal
script copies files to the directory named $PKGSAV
. When all the path names have been processed, the script
then goes back and removes all directories and files associated with the cfgdata class.
The outcome of this removal script is to copy config.data
to $PKGSAV
and then remove the config.data file and the data directory.