|
|
To modify /etc/inittab at the time of installation, you must:
The name of a script must be the name of the file that will be edited. in this case, the file to be edited is /etc/inittab and so the sed(C) script is named /etc/inittab. There are no requirements for the mode owner group of a sed script (represented in the sample prototype by question marks). The file type of the sed script must be e (indicating that it is editable). For an example, see the "sample prototype file" .
In the case of the sample pkginfo file, sed is the only class being installed. However, it could be one of any number of classes.
You cannot deliver a copy of /etc/inittab that looks the way you need for it to, because /etc/inittab has already been installed and is a dynamic file. Because of this, you have no way of knowing how it will look at the time of package installation. Using a sed script allows you to modify the /etc/inittab file during package installation.
As already mentioned, the name of a sed script should be the same as the name of the file it will edit. A sed script, including the example, contains sed commands to remove and add information to the file.
You need to inform the system that /etc/inittab has been modified by executing init q. The only place you can perform that action in this example is in a postinstall script. Looking at the example postinstall script, you see that its only purpose is to execute init q.
This approach to editing /etc/inittab during installation has two drawbacks. First, you have to deliver a full script (the postinstall script) simply to perform init q. In addition, the package name at the end of each comment line is hard-coded. It would be nice if this value could be based on the package instance so that you could distinguish between the entries you add for each package.