Monday, April 09, 2007

Creating Solaris Packages

Here is the link: http://www.sunfreeware.com/pkgadd.html

1. Create a clean /usr/local/ for install.

2. Go into the /usr/local directory with

unix# cd /usr/local

and run the command

unix# find . -print | pkgproto > prototype

This will produce the prototype file in /usr/local.

3.Now take your editor and edit out the line that has the prototype file name in it. Then add a line like

i pkginfo=./pkginfo

4. Finally, convert all the user and group ownerships from whatever they are to bin and bin (or whatever, see Red note below). An example file looks like

i pkginfo=./pkginfo
d none bin 0755 bin bin
f none bin/prog 0755 bin bin
d none doc 0755 bin bin
f none doc/doc1 0644 bin bin
d none lib 0755 bin bin
f none lib/lib1 0644 bin bin
d none man 0755 bin bin
d none man/man1 0644 bin bin
f none man/man1/prog.1 0444 bin bin

5. Now in /usr/local create a file pkginfo with contents for your package like

PKG="SCprog"
NAME="prog"
ARCH="sparc"
VERSION="1.00"
CATEGORY="application"
VENDOR="Christensen and Associates, Inc."
EMAIL="steve@smc.vnet.net"
PSTAMP="Steve Christensen"
BASEDIR="/usr/local"
CLASSES="none"
These values are fairly obvious, but they mean

PKG = the name you have chosen for the package directory
NAME = the program name
ARCH = the operating system version
VERSION = the version number for your program
CATEGORY = the program is an application
VENDOR = whoever wrote the software
EMAIL = an email contact
PSTAMP = the person who did the port perhaps
BASEDIR = the /usr/local directory where the files install
CLASSES = just put none here

6.Run pkgmk

Now while in /usr/local, run
unix# pkgmk -r `pwd`
This places a file in /var/spool/pkg called SCprog.

7. Run pkgtrans

Now do
unix# cd /var/spool/pkg
and then
unix# pkgtrans -s `pwd` /tmp/prog-1.00

You will be asked to select which package you want to make. Select you package name (like SCprog) by number.

This now creates a file called prog-1.00 in /tmp.