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 crontab Files During Installation

This case study modifies crontab files during package installation.

Techniques

This case study demonstrates the following techniques:

Approach

The most efficient way to edit more than one file during installation is to define a class and provide a class action script. If you used the build class approach, you would need to deliver one build class script for each crontab file edited. Defining a cron class provides a more general approach. To edit crontab files with this approach, you must:

Case Study Files

The i.cron and r.cron scripts described below are executed by superuser. Editing another user's crontab file as superuser may have unpredictable results. If necessary, change the following entry in each script:

crontab $user < /tmp/$$crontab ||

to

su $user -c "crontab /tmp/$$crontab" ||

The pkginfo Command

PKG=case7
NAME=Case Study #7
CATEGORY=application
BASEDIR=/opt
ARCH=SPARC
VERSION=Version 1.0
CLASSES=cron

The prototype File

i pkginfo
i i.cron
i r.cron
e cron /var/spool/cron/crontabs/root ? ? ?
e cron /var/spool/cron/crontabs/sys ? ? ?

The i.cron Installation Class Action Script

# PKGINST parameter provided by installation service
while read src dest
do
user=`basename $dest` ||
exit 2
(crontab -l $user |
sed -e "/#$PKGINST$/d" > /tmp/$$crontab) ||
exit 2
sed -e "s/$/#$PKGINST/" $src >> /tmp/$$crontab ||
exit 2
crontab $user < /tmp/$$crontab ||
exit 2
rm -f /tmp/$$crontab
done
exit 0

The r.cron Removal Class Action Script

# PKGINST parameter provided by installation service
while read path
do
user=`basename $path` ||
exit 2
(crontab -l $user |
sed -e "/#$PKGINST$/d" > /tmp/$$crontab) ||
exit 2
crontab $user < /tmp/$$crontab ||
exit 2
rm -f /tmp/$$crontab
done
exit 

crontab File #1

41,1,21 * * * * /usr/lib/uucp/uudemon.hour > /dev/null
45 23 * * * ulimit 5000; /usr/bin/su uucp -c
"/usr/lib/uucp/uudemon.cleanup" >
/dev/null 2>&1
11,31,51 * * * * /usr/lib/uucp/uudemon.poll > /dev/null

crontab File #2

0 * * * 0-6 /usr/lib/sa/sa1
20,40 8-17 * * 1-5 /usr/lib/sa/sa1
5 18 * * 1-5 /usr/lib/sa/sa2 -s 8:00 -e 18:01 -i 1200 -A

Note - If editing of a group of files will increase total file size by more than 10K, supply a space file so the pkgadd command can allow for this increase. For more information on the space file, see Reserving Additional Space on a Target System.