How To Add Pre-/Post-Scripts to IPS Packages

Package Scripting

My last post about Solaris 11 triggered an interesting discussion with UX-admin about IPS and the lack of pre-/post-scripts for installation/removal.

Assuming that Solaris 11 will be based on IPS just like OpenSolaris, it is certain that sysadmins will have to change a lot in how they create and manage packages, because IPS is fundamentally different from the good old System V packaging system.

So let's explore the lack of scripting hooks in IPS and see if we can find some ways of working around them:

OpenSolaris Home Server Scripting 3: Managing Package Repositories

Package Scripting

OpenSolaris OS comes with the Image Packaging System (IPS) for managing installation and additional software. By default, it is configured to pull packages from the /release repository, but of course there are many other interesting repositories with software to install from.

Chris Gerhard recommends adding at least the /extras repository (free, registration required) so you can easily install VirtualBox, Adobe Flash, TrueType Fonts etc.

If you have a support contract or are an Oracle/Sun employee, you may want to switch your preferred repository to the supported one. The more adventurous may want to switch to the development repository.

Then, the Software Porting Community on has a hierarchical system for making open source software available on OpenSolaris through two repositories: /pending and /contrib.

And then there are a couple of more repositories from user groups, private people, companies offering commercial packages and so on.

One way to register package repositories with the IPS on your home server is by using the package management GUI, or by using the pkg(1) command (See also: "How to Add or Update a Publisher").

But of course we want to stick to our "Script Everything" philosophy and write ourselves a small script that takes care of all of our package configuration needs.