JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Application Packaging Developer's Guide
search filter icon
search icon

Document Information

Preface

1.  Designing a Package

2.  Building a Package

3.  Enhancing the Functionality of a Package (Tasks)

4.  Verifying and Transferring a Package

5.  Case Studies of Package Creation

Soliciting Input From the Administrator

Techniques

Approach

Case Study Files

The pkginfo File

The prototype File

The request Script

Creating a File at Installation and Saving It During Removal

Techniques

Approach

Case Study Files

The pkginfo File

The prototype File

The space File

The i.admin Class Action Script

The r.cfgdata Removal Script

Defining Package Compatibilities and Dependencies

Techniques

Approach

Case Study Files

The pkginfo File

The copyright File

The compver File

The depend File

Modifying a File by Using Standard Classes and Class Action Scripts

Techniques

Approach

Case Study Files

The pkginfo File

The prototype File

The i.inittab Installation Class Action Script

The r.inittab Removal Class Action Script

The inittab File

Modifying a File by Using the sed Class and a postinstall Script

Techniques

Approach

Case Study Files

The pkginfo File

The prototype File

The sed Class Action Script (/etc/inittab)

The postinstall Script

Modifying a File by Using The build Class

Techniques

Approach

Case Study Files

The pkginfo File

The prototype File

The Build File

Modifying crontab Files During Installation

Techniques

Approach

Case Study Files

The pkginfo Command

The prototype File

The i.cron Installation Class Action Script

The r.cron Removal Class Action Script

crontab File #1

crontab File #2

Installing and Removing a Driver With Procedure Scripts

Techniques

Approach

Case Study Files

The pkginfo File

The prototype File

The request Script

The postinstall Script

The preremove Script

Installing a Driver by Using the sed Class and Procedure Scripts

Techniques

Approach

Case Study Files

The pkginfo File

The prototype File

The sed Class Action Script (/etc/devlink.tab)

The postinstall Installation Script

The preremove Removal Script

The copyright File

6.  Advanced Techniques for Creating Packages

Glossary

Index

Modifying a File by Using the sed Class and a postinstall Script

This case 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 described in Modifying a File by Using Standard Classes and Class Action Scripts and Modifying a File by Using The build Class. The file modified is /etc/inittab.

Techniques

This case study demonstrates the following techniques:

Approach

To modify /etc/inittab at the time of installation, using the sed class, you must complete the following tasks:

This approach to editing /etc/inittab during installation has one drawback; you have to deliver a full script (the postinstall script) simply to perform the init q command.

Case Study Files

The pkginfo File
PKG=case4
NAME=Case Study #4
CATEGORY=applications
BASEDIR=/opt
ARCH=SPARC
VERSION=Version 1d05
CLASSES=sed
The prototype File
i pkginfo
i postinstall
e sed /etc/inittab ? ? ?
The sed Class Action Script (/etc/inittab)
!remove
# remove all entries from the table that are associated
# with this package, though not necessarily just
# with this package instance
/^[^:]*:[^:]*:[^:]*:[^#]*#ROBOT$/d
!install
# remove any previous entry added to the table
# for this particular change
/^[^:]*:[^:]*:[^:]*:[^#]*#ROBOT$/d
# add the needed entry at the end of the table;
# sed(1) does not properly interpret the '$a'
# construct if you previously deleted the last
# line, so the command
# $a\
# rb:023456:wait:/usr/robot/bin/setup #ROBOT
# will not work here if the file already contained
# the modification. Instead, you will settle for
# inserting the entry before the last line!
$i\
rb:023456:wait:/usr/robot/bin/setup #ROBOT
The postinstall Script
# make init re-read inittab
/sbin/init q ||
exit 2
exit 0