|
|
This study modifies a file which exists on the installation machine during package installation. It uses one of three modification methods. The other two methods are shown in case study 5a and case study 5b. The file modified is /etc/inittab.
This case study shows an example of using the build class.
This approach to modifying /etc/inittab uses the build class. A build class file is executed as a shell script and its output becomes the new version of the file for which it is named. In other words, the file inittab(F) that is delivered with this package is executed and the output of that execution becomes /etc/inittab.
The build class file is executed during package installation and package removal. The argument install is passed to the file if it is being executed at installation time. Notice in the sample build file that installation actions are defined by testing for this argument.
To edit /etc/inittab using the build class, you must:
The prototype file entry for the build class file should be of class build and file type e. Be certain that the CLASSES parameter in the pkginfo file includes build. See the sample pkginfo file and sample prototype file for this example.
The sample build file performs the following procedures:
PKG='case5c' NAME='Case Study 5c' CATEGORY='applications' ARCH='3b2' VERSION='Version 1d05' CLASSES='build'
i pkginfo e build /etc/inittab=/home/case5c/inittab.build ? ? ?
# PKGINST parameter provided by installation service# remove all entries from the existing table that # are associated with this PKGINST sed -e "/^[^:]*:[^:]*:[^:]*:[^#]*#$PKGINST$/d" /etc/inittab || exit 2
if [ "$1" = install ] then # add the following entry to the table echo "rb:023456:wait:/usr/robot/bin/setup #$PKGINST" || exit 2 fi /sbin/init q || exit 2 exit 0