Creating System V/Solaris Packages

I recently was called on to create a Solaris (SYSV) format package of the Redhat Package Manager (RPM). Since I have been asked a few times how I did, this, I thought I would take a little time and post the answer on the web, so that I could just point people at the answer in the future, and not have to keep the mail message around. 8^)

When I started, I had no idea how to do this, either, so I found a couple of documents about this. The URL which helped me the most is:

  • http://kira.acomp.usf.edu/solaris/packages.html

    If you have any specific questions not answered by these, let me know.

    The steps that I took, in general, are:

    1. 'create pkginfo file' > pkginfo
    2. 'create list of files in pkg' > pkglist
    3. 'create a postinstall script >postinstall.sh
    4. pkgmk -f pkglist -r / -o
    5. pkgtrans -s /var/spool/pkg/ /tmp/pkg-name.pkg pkg-name
    Here is what the relevant files looked like for rpm: pkglist:

    pkglist file

    i pkginfo=pkginfo 
    i postinstall=postinstall.sh 
    d none /usr ? ? ? 
    d none /usr/local ? ? ? 
    d none /usr/local/bin ? ? ? 
    d none /usr/local/include ? ? ? 
    d none /usr/local/lib ? ? ? 
    d none /usr/local/man ? ? ? 
    d none /usr/local/man/man8 ? ? ? 
    f none /usr/local/bin/rpm 0755 bin bin 
    f none /usr/local/bin/rpm2cpio 0755 bin bin 
    f none /usr/local/bin/find-provides 0755 bin bin 
    f none /usr/local/bin/find-requires 0755 bin bin 
    d none /usr/local/include/rpm 0755 bin bin 
    f none /usr/local/include/rpm/dbindex.h 0644 bin bin 
    f none /usr/local/include/rpm/header.h 0644 bin bin 
    f none /usr/local/include/rpm/rpmlib.h 0644 bin bin 
    f none /usr/local/lib/librpm.a 0644 bin bin 
    f none /usr/local/lib/rpmpopt 0644 bin bin 
    f none /usr/local/lib/rpmrc 0644 bin bin 
    f none /usr/local/man/man8/rpm.8 0644 bin bin 
    f none /usr/local/man/man8/rpm2cpio.8 0644 bin bin 
    d none /var/local 0755 bin bin 
    d none /var/local/lib 0755 bin bin 
    d none /var/local/lib/rpm 0755 bin bin 
    

    pkginfo file

    PKG="rpm"
    NAME="Red Hat Package Manager" 
    ARCH="sparc" 
    VERSION="2.4.3" 
    CATEGORY="administration" 
    DESC="rpm 2.4.3, package installation/monitoring tool for maintaining files 
    as part of packages" CLASSES="none" 
    
    postinstall.sh:

    postinstall.sh script

    #!/bin/sh 
    # RPM post-installation script 
    # Rob Payne  07/10/97 
     
    # Initialize Database 
    if [ -f '/var/local/lib/rpm/packages.rpm' ]; then 
            echo "RPM Database already exists, doing nothing" 
    else 
            echo "Initializing RPM Database, as it doesn't already exist" 
            /usr/local/bin/rpm --initdb 
    fi 
    

    Rob Payne
    Last modified: Sun Nov 11 11:59:30 EST 2001