Файлы практических примеров
Файл pkginfo
PKG=krazy
NAME=KrAzY Applications
CATEGORY=applications
BASEDIR=/opt
ARCH=SPARC
VERSION=Version 1
CLASSES=none cfgdata admin
|
Файл prototype
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
|
Файл space
# extra space required by config data which is
# dynamically loaded onto the system
data 500 1
|
Сценарий действия над классом i.admin
# 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
|
Здесь продемонстрирован редкий случай, когда команда installf может быть необходима для сценария действия над классом. Поскольку файл space использовался для резервирования пространства в конкретной файловой системе, этот новый файл может быть добавлен в пакет несмотря на то, что он не включен в файл pkgmap.
Сценарий удаления r.cfgdata
# 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
|