Application Packaging Developer's Guide

The preserve Class Script

The preserve class preserves a package object file by determining whether or not an existing file should be overwritten when the package is installed. Two possible scenarios when using a preserve class script are:

Both scenario outcomes are considered successful by the preserve script. A failure occurs only, when in the second scenario, the file is unable to be copied to the target directory.

Starting with the Solaris 7 release, the i.preserve script and a copy of this script, i.CONFIG.prsv, can be found in the /usr/sadm/install/scripts directory with the other class action scripts.

Figure 3-3 Format of a preserve Class Action Script


#ident "$Header: i.CONFIG.prsv,v 12.1 1997/09/19 $"
 
error=no
echo "## checking common configuration files"
while read src dest
do
      [ "$src" = /dev/null ] && continue
 
      if [ -f "$dest" ]
      then
              echo $dest preserved
      else
              echo $dest
              cp $src $dest || error=yes
      fi
 
done
[ "$error" = yes ] &&
        exit 2
exit 0

Modify the script to include the filename or filenames you would like to preserve.