Besides several Linux VMs, I am using Solaris 11 for some of my home-tinkering systems. After an undetected three day outage of my mail server, I decided to install a monitoring solution for my systems.
Unwilling to go through the configure, make, make install triple jump every time I install a system, I set out to create a local IPS repository to serve my needs (and packages).
The traditional workflow for package creation (e.g. rpm, and dpkg) is
Get the pristine sources.
Get all patches.
Write a control file (RPM: specfile, Debian: controlfile) that describes:
All build- and runtime dependencies,
the order, in which the patches are to be applied to the pristine sources,
the build script, and
all files that are part of the final package.
Optionally: Scripts to be executed at pre/post (de)installation time.
A packaging tool (dpkg-deb / rpmbuild) takes the controlfile to patch and build the sources, and to …
… assemble the package into a file.
Although dpkg and rpm differ, this process is not too far off to describe both systems.
In contrast to the file based systems, Solaris IPS works differently. Packages are assembled in a repository and not as a file on the local filesystem. Furthermore, there is not necessarily a controlfile. To worsen things, documentation, besides man pages (e.g. pkgsend, pkg), is rather sparse.
Two things are very different between rpm and IPS: Assembling an rpm-package includes a build step, where the source is compiled. This step is completely out of scope for IPS.
Another major difference is patching: rpm clearly separates between pristine source and patches. A classical rpm-controlfile references the pristine (upstream) sources and each to be applied patch explicitly. In contrast to that, IPS ignores only handles the build output.
Update: “pkgbuild”:“http://pkgbuild.sourceforge.net/” looks like a good candidate, to quote from the site:
pkgbuild is a tool for building Solaris SVr4 or IPS packages from RPM-like spec files. It is intended to be a plug-in replacement of the rpmbuild command. Most spec file elements are implemented plus a few more. The differences from real rpm spec files are summarised in the Manual It’s implemented as a set of perl scripts and modules.
I use several systems for package creation and -test. Each system is implemented as Solaris zone. Test systems are regularly reset to a known state by using zfs snapshots.
In listings the following prefixes are used when it is necessary to distinguish between systems:
host $ ... is the prefix used for the user root at the “global zone”.
ips $ ... denotes the user root inside the ips-zone.
ips-test $ ... denotes the user root inside the ips-test-zone.
client $ ... shows commands executed on clients (user root). Normally, this is a test client.
packager $ ... is the prefix used for the user jens, logged into the zone where the packages are prepared.
This article assumes that you have a write enabled IPS repository running on your network. Mine is the publisher neuhalfen.name and is reacheable under http://ips.local.neuhalfen.name:80 . If you have not already done so, read how to create such a server here.
On the packaging machine
The packager is the machine that is used to create the packages.
First step: Make the repository known to the local IPS installation. This is not strictly necessary for package creation, but allows us to test package installation from packager.
Last, but not least, the import command: It imports an already existing directory. It does not allow relocation, that is in our case it would be necessary to first install our program in /opt/yesno and then import it.
More helpful is the generate command. It spits out a manifest for a directory.
pkgsend generate root
dir group=bin mode=0755 owner=root path=bin timestamp=20110724T215918Z
dir group=bin mode=0755 owner=root path=bin/x timestamp=20110705T001347Z