To modify /etc/inittab during installation, you must:
Create a class called inittab. You must provide an installation and a removal class action script for this class. Define the inittab class in the CLASSES parameter in the sample pkginfo file.
This file contains the information for the entry that you will add to /etc/inittab. Notice in the sample prototype file that inittab is a member of the inittab class and has a file type of e for editable. The sample inittab file upon which this is based is also shown.
Because class action scripts must be multiply executable (you get the same results each time they are executed), you cannot just add our text to the end of the file. The sample class action script, performs the following procedures:
Note that init q can be performed by this installation script. A one-line postinstall script is not needed by this approach.
The sample removal script is very similar to the installation script. The information added by the installation script is removed and init q is executed.
This case study resolves the drawbacks to case study 5a. You can support multiple package instances because the comment at the end of the inittab entry is now based on package instance. Also, you no longer need a one-line postinstall script. However, this case has a drawback of its own. You must deliver two class action scripts and the inittab(F) file to add one line to a file. Case 5c shows a more streamlined approach to editing /etc/inittab during installation.