Creating Solaris packages.

Procedure of creating packages for Solaris is quite trivial, it is done in several steps:

1.We must install program on our test system.
2.Create file which includes paths to all files which will be installed.
Lets name it files. Assume that you have installed apache web server in /usr/local/apache directory then you can do this:
%cd /usr/loca/apache
%find . -print >/tmp/files.
3.Create prototype file which will describe permissions and type of each file in a package.
% cat /tmp/files | pkgproto > /tmp/Prototype
4. Now it's time to make scripts which will do preparation/cleaning job during package installation and/or removal.
They has self describing names:
preinstall,postinstall,preremove,postremove,checkinstall,request,depend.
Of course it is not mandatory, package can be without these files.
5.Create pkginfo file it will look like this:
PKG="Apache"
NAME="Apache"
ARCH="sparc"
VERSION="1.3.14"
CATEGORY="application"
VENDOR="Unixinmind ltd"
EMAIL="nonexist@nowhere"
PSTAMP="Oleksii Dzhulai"
BASEDIR="/usr/local/apache"
CLASSES="none"
It will be used by packaging system.
6. Include scripts and pkginfo file to Prototype, it will be something like this:

i ./pkginfo
i ./preinstall
d none bin 0755 nobody nobody
f none bin/httpd 0755 nobody nobody
f none bin/ab 0755 nobody nobody
....

7. Run:
pkgmk -o -r /
This command creates package file structure in /var/spool/pkg/Apache.
8. To convert package to stream format:
pkgtrans -s /var/spool/pkg /tmp/Apache-1.3.14.tar

Package is ready!!

For more information:
http://docs.sun.com/app/docs/doc/817-0406

Comments