How to make a Solaris package of existing binaries

This page assumes you have existing binaries, rather than a source tree, and you want to encapsulate them in a SysV package. It also assumes you have a directory that only holds the binaries you care about. (eg: /export/home/yourapp). Otherwise you'll have to do more work
Compared to my other pages, this is a quick-n-dirty job. This will make a package that is NOT relocatable. lets assume you want to "hypothetically speaking", package up /export/home/OpenOffice. You would do the following steps, assuming you have enough room in /tmp to hold 2*space of binaries --
  1. cd /tmp
  2. echo 'i pkginfo' >prototype
  3. pkgproto /export/home/OpenOffice >>prototype
    (If this is a shared dir like /usr/local, you should trim the prototype file after it is auto-generated)
  4. Create the file 'pkginfo' with the following fields:
       ARCH=(sparc or i386 here)
       NAME=Short Description here
  5. pkgmk -d /tmp -r /
  6. pkgtrans -s /tmp YOURpkgname.pkg
Dont forget to rm -r /tmp/YOURpkgname, and mv newfile.pkg somewhere else when done.

You now have a file /tmp/$PKGNAME.pkg suitable for use with

pkgadd -d $PKGNAME.pkg
in Solaris.

See the other makeapackage pages for information on dependancies.

Interesting tricks

FYI: the 'pkgmk -r /' was because we specify full, absolute paths. it is also possible to run the pkgproto from /export/home, making the starting directory in the prototype file be 'OpenOffice'.

In this case, you would use "pkgmk -d /tmp -b /export/home BASEDIR=/export/home", rather than "pkgmk -r /"

If you also want your package gzipped, but you're in a hurry, you can also use

pkgtrans -s /tmp /dev/fd/1 YOURpkgname | gzip >/tmp/YOURpkgname.pkg.gz

Written by: Philip Brown
Solaris Top