Sun Microsystems, Inc.
spacerspacer
spacer www.sun.com docs.sun.com |
spacer
black dot
 
 
5.  Package Creation Case Studies Creating a File at Installation and Saving It During Removal Approach  Previous   Contents   Next 
   
 

Case Study Files

The pkginfo File

PKG=krazy
NAME=KrAzY Applications
CATEGORY=applications
BASEDIR=/opt
ARCH=SPARC
VERSION=Version 1
CLASSES=none cfgdata admin

The prototype File

i pkginfo
i request
i i.admin
i r.cfgdata
d none bin 555 root sys
f none bin/process1 555 root other
f none bin/process2 555 root other
f none bin/process3 555 root other
f admin bin/config 500 root sys
d admin cfg 555 root sys
f admin cfg/datafile1 444 root sys
f admin cfg/datafile2 444 root sys
f admin cfg/datafile3 444 root sys
f admin cfg/datafile4 444 root sys
d cfgdata data 555 root sys

The space File

# extra space required by config data which is
# dynamically loaded onto the system
data 500 1

The i.admin Class Action Script

# PKGINST parameter provided by installation service
# BASEDIR parameter provided by installation service
while read src dest
do
   cp $src $dest || exit 2
done
# if this is the last time this script will be executed
# during the installation, do additional processing here.
if [ "$1" = ENDOFCLASS ]
then
# our config process will create a data file based on any changes
# made by installing files in this class; make sure the data file
# is in class `cfgdata' so special rules can apply to it during
# package removal.
   installf -c cfgdata $PKGINST $BASEDIR/data/config.data f 444 root
   sys || exit 2
   $BASEDIR/bin/config > $BASEDIR/data/config.data || exit 2
   installf -f -c cfgdata $PKGINST || exit 2
fi
exit 0

This illustrates a rare instance in which installf is appropriate in a class action script. Because a space file has been used to reserve room on a specific file system, this new file may be safely added even though it is not included in the pkgmap file.

The r.cfgdata Removal Script

# the product manager for this package has suggested that
# the configuration data is so valuable that it should be
# backed up to $PKGSAV before it is removed!
while read path
do
# path names appear in reverse lexical order.
   mv $path $PKGSAV || exit 2
   rm -f $path || exit 2
done
exit 0

Defining Package Compatibilities and Dependencies

The package in this case study uses optional information files to define package compatibilities and dependencies, and to present a copyright message during installation.

Techniques

This case study demonstrates the following techniques:

  • Using the copyright file

  • Using the compver file

  • Using the depend file

For more information on these files, see "Creating Information Files".

Approach

To meet the requirements in the description, you must:

  • Create a copyright file.

    A copyright file contains the ASCII text of a copyright message. The message shown in the sample file is displayed on the screen during package installation.

  • Create a compver file.

    The pkginfo file shown in the next figure defines this package version as version 3.0. The compver file defines version 3.0 as being compatible with versions 2.3, 2.2, 2.1, 2.1.1, 2.1.3 and 1.7.

  • Create a depend file.

    Files listed in a depend file must already be installed on the system when a package is installed. The example file has 11 packages which must already be on the system at installation time.

Case Study Files

The pkginfo File

PKG=case3
NAME=Case Study #3
CATEGORY=application
BASEDIR=/opt
ARCH=SPARC
VERSION=Version 3.0
CLASSES=none
 
 
 
  Previous   Contents   Next