This post intends to serve as a basic introduction/guide for Solaris Packages.

Package Basics:
A package is a collection of directories and files needed by a software product to run. A package contains product objects(app files that need to be installed) and control files(information files and installation scripts) that control what goes where and how.

Creating a Package:
To create a Package you need at least three objects namely “pkginfo” & “prototype” files and “package objects”.

pkginfo: contains the meta data for the package like name, desc, and destination for package objects(BASEDIR) it looks like:

Line 1 specifies the path for information and installation files(all files are on same level here).
Line 2 and 3 signify that two scripts namely preinstall and postinstall are to be included in the package and executed before and after installation of package respectively.
Line 4 specifies the directory where the files mentioned in next two lines will be foundNote: The search is limited to the specific directories listed and does not search recursively.
Line 8 will create the directory demo-app in /var/log.
do “pkgproto ./SOURCE_DIR/ > prototype” to create a basic prototype file(replicating SOURCE_DIR’s structure)

1) It would be a better option to write a script that generates “pkginfo” & “prototype” files and builds the package.
2) I wrote such a script in python that
a) reads a config file(using ConfigParser) containing meta data for package.
b) calls a shell script that makes the “pkginfo” file using pkgproto command(and parameters sent by py script) and creates a temp prototype file replicating a directory which has all the directories and files that need to be ported.
c) append multiple “!search SOURCE_DIR” to accommodate sub directories(I couldn’t find a cleaner way).
d) make changes to the destination paths for individual files that need to go to custom locations.