|
|
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.
This case study shows examples of the following:
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.
# Format for the setinfo file. Field separator is: <tab> # pkg parts default category package_name # abbr y/npkgw 1 y system Package W pkgx 1 y system Package X pkgy 2 n system Package Y pkgz 1 y system Package Y
# set packaging files i pkginfo i preinstall i request i setinfo i copyrighti pkgw/request=pkgw.request i pkgw/response=pkgw.response i pkgx/request=pkgx.request i pkgx/response=pkgx.response
for PKG in $PKGLIST do echo "$PKG" >>$SETLIST done
# 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' 0while 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