JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Application Packaging Developer's Guide     Oracle Solaris 10 1/13 Information Library
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 build Class

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 sed Class and a postinstall Script. The file modified is /etc/inittab.

Techniques

This case study demonstrates how to use the build class. For more information on the build class, see The build Class Script.

Approach

This approach to modifying /etc/inittab uses the build class. A build class script is executed as a shell script and its output becomes the new version of the file being executed. In other words, the data file /etc/inittab that is delivered with this package will be executed and the output of that execution will become /etc/inittab.

The build class script 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 class script that installation actions are defined by testing for this argument.

To edit /etc/inittab using the build class, you must complete the following tasks:

This solution addresses the drawbacks described in the case studies in Modifying a File by Using Standard Classes and Class Action Scripts and Modifying a File by Using the sed Class and a postinstall Script. Only one short file is needed (beyond the pkginfo and prototype files). The file works with multiple instances of a package since the PKGINST parameter is used, and no postinstall script is required since the init q command can be executed from the build class script.

Case Study Files

The pkginfo File

PKG=case6
NAME=Case Study #6
CATEGORY=applications
BASEDIR=/opt
ARCH=SPARC
VERSION=Version 1d05
CLASSES=build

The prototype File

i pkginfo
e build /etc/inittab ? ? ?

The Build File

# 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