DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Packaging your software applications

7a. Create a Set Installation Package

This case study shows an example of creating a Set Installation Package (SIP) that is used to control the installation of a set of packages.

Techniques

This case study shows examples of the following:

Approach

  1. Create a request script script to ask the installer how the set should be installed.

  2. Should default installation be performed on this set?

    When the answer is yes, if any of the set's member packages require interaction and if default responses for that interaction have been provided, install the set using the default responses.

    When the answer is no, for each package in the set, prompt as to whether this package should be installed.

    When the answer is yes, if it is interactive (the package has a request script), should default installation of the package be performed?

    If yes, use the default response file.

    If no, execute the package's request script to obtain the responses.

  3. When the request script has completed, the PKGLIST variable should contain the list of selected set member packages that will be installed on the system. At this time:

setinfo file

   # Format for the setinfo file.  Field separator is: <tab>
   # pkg	 parts	default	category	package_name
   # abbr		y/n
   

pkgw 1 y system Package W pkgx 1 y system Package X pkgy 2 n system Package Y pkgz 1 y system Package Y

prototype file

   # set packaging files
   i pkginfo
   i preinstall
   i request
   i setinfo
   i copyright
   

i pkgw/request=pkgw.request i pkgw/response=pkgw.response i pkgx/request=pkgx.request i pkgx/response=pkgx.response

preinstall script file

   for PKG in $PKGLIST
   do
   	echo "$PKG" >>$SETLIST
   done

request script file

   # If <DELETE> is pressed, make sure we exit 77 so pkgadd knows
   # no packages were selected for installation.  In this case,
   # pkgadd will also not install the SIP itself.
   trap 'EXITCODE=77; exit' 2
   trap 'exit $EXITCODE' 0
   

while read pkginst parts default category package_name do echo $pkginst >>/tmp/order$$ if [ "$default" = "y" ] then echo $pkginst >>/tmp/req$$ else echo $pkginst >>/tmp/opt$$ fi done <$SETINFO

REQUIRED=`cat /tmp/req$$ 2>/dev/null` OPTIONAL=`cat /tmp/opt$$ 2>/dev/null` ORDER=`cat /tmp/order$$ 2>/dev/null` rm -f /tmp/opt$$ /tmp/req$$ /tmp/order$$ HELPMSG="Enter 'y' to run default set installation or enter 'n' to run custom set installation."

PROMPT="Do you want to run default set installation?"

ANS=`ckyorn -d y -p "$PROMPT" -h "$HELPMSG"`|| exit $?

if [ "$ANS" = "y" ] then # Default installation for PKG in $REQUIRED do PKGLIST="$PKGLIST $PKG" if [ -f $REQDIR/$PKG/response ] then cp $REQDIR/$PKG/response $RESPDIR/$PKG fi done echo "PKGLIST=$PKGLIST" >> $1 else # Custom installation of required packages for PKG in $REQUIRED do PKGLIST="$PKGLIST $PKG" if [ -f $REQDIR/$PKG/request ] then PROMPT="Do you want default installation for $PKG?" RANS=`ckyorn -d y -p "$PROMPT" -h "$HELPMSG"` || exit $? if [ "$RANS" = "y" ] then cp $REQDIR/$PKG/request $RESPDIR/$PKG else sh $REQDIR/$PKG/request $RESPDIR/$PKG fi fi done

# Select which optional packages in set are to be installed for PKG in $OPTIONAL do HELPMSG="Enter 'y' to install $PKG as part of this set installation or 'n' to skip installation." PROMPT="Do you want to install $PKG?" PANS=`ckyorn -d y -p "$PROMPT" -h "$HELPMSG"` || exit $?

if [ "$PANS" = "y" -o "$PANS" = "" ] then PKGLIST="$PKGLIST $PKG" if [ -f $REQDIR/$PKG/request ] then PROMPT="Do you want default installation for $PKG?" RANS=`ckyorn -d y -p "$PROMPT" -h "$HELPMSG"` || exit $? if [ "$RANS" = "y" ] then cp $REQDIR/$PKG/request $RESPDIR/$PKG else sh $REQDIR/$PKG/request $RESPDIR/$PKG fi fi fi done echo "PKGLIST=$PKGLIST" >> $1 fi

if [ "$PKGLIST" = "" ] then EXITCODE=77 fi export SETPKGS


Next topic: 7b. Split one set into two
Previous topic: sys crontab file (delivered with package)

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