SUMMARY: Creating Packages in Solaris

From: Jon M. Hayden (
Date: Wed Dec 08 1999 - 13:40:18 CST

Original Question:
I have a package that installs a lot of files, but I was wondering if there
is a way to pick which files get installed. For example, here is a list of
files that get installed:

(These aren't the real files...this is just an example)

But, let's say, based on some criteria, I only wanted to install the first 5
files. To manually do this, I can remove the first 5 from the pkgmap file
and run pkgadd and it will work great. But, is there a way to automatically
do this in the preinstall or checkinstall script? I tried adding a line in
the preinstall script that removes these files from the pkgmap file, but it
didn't work. I beleive the pkgmap file is read before the preinstall script
even runs, because all the files got installed even after the files were
removed from the pkgmap file (I verified that they were removed from the
pkgmap file after the preinstall script ran). I have a feeling I'm going to
have to write my own install script that runs before pkgadd.

My Solution:
I found through some research of my own that if I do file manipulation in the
request script, I was able to modify the pkgmap file prior to the pkgadd
command reading it. This way I was able to remove files I didn't want
installed from the pkgmap file during the request script execution. I did
receive a couple good replies, but I didn't have the time to do the research
and implement some of the suggestions. I probably would of went with the
"class" suggestion if I had the time to implement it.

Check out
There are some pretty good instructions on making packages.
-Dave Foster

You'll need to check the answerbook on creating packages for
exact details, but in short "editable" files is possibly the
way to do it.
Files such as /etc/passwd , /etc/default/init and so on
are edited on install rather than just copied in. Your
solaris packages on the CD can show how some of this is done,
but basically you have a "class" of files that are installed via
a script rather than copied right in.
e.g. multiple packages might want to edit nsswitch.conf, so prototype has:
i i.nsswitch
i r.nsswitch
e nsswitch etc/nsswitch.conf 0644 root sys
Where i.nsswitch is a script you write that runs on install (pkgadd),
and r.nsswitch is a script you write that runs on remove (pkgrm).
An install script reads two names from stdin (the literal file in the
package and the target file). At this point one normally does a bunch
of tests and seds to see what to copy in or change etc. but you may
wish to simply cp in based on your own criteria.
A remove script just reads in the name of the file being removed, but
if you dont include a remove script pkgrm will just delete the file.
I suspect this stuff can change significantly between OS revisions,
so FYI I'm doing this sort of thing using Solaris 7 ..
-Adam Barclay

I think what you're looking for is `removef'. It supposedly
lets you tweak what files are going to be added on the fly. The
Applications Packaging guide mentions it in passing, but I've never
actually used it.
-Mike Fletcher

Thanks to everyone that replied!

This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:13:34 CDT