Design Rules for checkinstall Scripts
There can be only one checkinstall script per package and it must be named checkinstall.
The environment variable assignments should be added to the installation environment for use by the pkgadd command and other packaging scripts by writing them to the response file (known to the script as $1).
System environment variables and standard installation environment variables, except for the CLASSES and BASEDIR parameters, cannot be modified by a checkinstall script. Any of the other environment variables you created can be changed.
Every environment variable that the checkinstall script may manipulate should be assigned a default value in the pkginfo file.
The format of the output list should be PARAM=value. For example:
CLASSES=none class1
Administrator interaction is not permitted during execution of a checkinstall script. All administrator interaction is restricted to the request script.
How to Gather File System Data
Make the directory containing your information files the current working directory.
Create a file named checkinstall with your favorite text editor.
Save your changes and quit the editor when you are done.
Complete one of the following tasks.
If you want to create additional installation scripts, skip to the next task, "How to Write Procedure Scripts".
If you have not created your prototype file, complete the procedure "How to Create a prototype File Using the pkgproto Command", and skip to Step 5.
If you have already created your prototype file, edit it and add an entry for the installation script you just created.
Build your package.
See "How to Build a Package", if needed.
Where to Go Next
After you build the package, install it to confirm that it installs correctly and verify its integrity. Chapter 4, Verifying and Transferring a Package explains how to do this and provides step-by-step instructions on how to transfer your verified package to a distribution medium.
Example--Writing a checkinstall Script
This example checkinstall script checks to see if database software needed by the SUNWcadap package is installed.
# checkinstall script for SUNWcadap # # This confirms the existence of the required specU database # First find which database package has been installed. pkginfo -q SUNWspcdA # try the older one if [ $? -ne 0 ]; then pkginfo -q SUNWspcdB # now the latest if [ $? -ne 0 ]; then # oops echo "No database package can be found. Please install the" echo "SpecU database package and try this installation again." exit 3 # Suspend else DBBASE="`pkgparam SUNWsbcdB BASEDIR`/db" # new DB software fi else DBBASE="`pkgparam SUNWspcdA BASEDIR`/db" # old DB software fi # Now look for the database file we will need for this installation if [ $DBBASE/specUlatte ]; then exit 0 # all OK else echo "No database file can be found. Please create the database" echo "using your installed specU software and try this" echo "installation again." exit 3 # Suspend fi |
Writing Procedure Scripts
The procedure scripts provide a set of instructions to be performed at particular points in package installation or removal. The four procedure scripts must be named one of the predefined names, depending on when the instructions are to be executed, and are executed without arguments.
-
Runs before class installation begins. No files should be installed by this script.
-
Runs after all volumes have been installed.
-
Runs before class removal begins. No files should be removed by this script.
-
Runs after all classes have been removed.