Solaris tip of the week: Create your own svr4 and ips packages
On Solaris, you now have two choices for packaging your software:
- the traditional svr4-style package
- the new image packaging system (IPS)-style package.
By adopting a few source control conventions, I'll show you how to
automate the packaging process for each of these formats. I always find it easier to learn by example, so I have a couple scripts to help you create packages in each of these formats.
In this example, I will be packaging the opensource 'balance' utility for Solaris. The 'balance' utility a software load balancing application, available for download from http://www.inlab.de/balance.html
First Step: download and build the executable:
Compiling balance produces the following files:
/usr/local/sbin/balance
/usr/local/share/man/man1/balance.1
Create an SVR4 package
The SVR4 package requires two control files - pkginfo and prototype - in addition to the files you wish to distribute. Solaris includes a set of svr4 packaging utilities for package creation ... To build an SVR4bal package, you will:
- create directory SVR4bal
- copy the /usr/local/sbin/balance and /usr/local/share/man/man1/balance.1 files into SVR4bal
- create a pkginfo file in directory SVR4bal
- create a prototype file with the Solaris 'pkgproto' utility.
- execute pkgmk command to create the package
- execute pkgtrans command if you prefer the datastream format of the package.
The makesvr4.sh automates this process - to create your new SVR4bal package, run:
# ./makesvr4.sh SVR4bal
To install your svr4 package:
# pkgadd -d datastream/SVR4bal
To uninstall your svr4 package:
# pkgrm SVR4bal
Create an IPS package
IPS is the new format developed for OpenSolaris. IPS-style packages are published to a web repository and installed over the network. To create an IPS package you use the pkgsend utility to register package name and upload the files into your repository.
If we adopt a convention similar to svr4, we can automate the creation of IPS packages as follows:
- Create the directory IPSbal/content
- Copy the /usr/local/sbin/balance and /usr/local/share/man/man1/balance.1 files into IPSbal/content
- Use a script to register all objects in IPSbal/content as package name IPSbal
The makeips.sh script automates this process - to create your ips package, run:
# ./makeips.sh IPSbal
To install this package:
# pkg install IPSbal
To uninstall this package:
# pkg uninstall IPSbal
For makeips.sh one remark:
Need change #!/bin/sh to bash or ksh
After it will work
Posted by Alex on December 05, 2008 at 03:53 AM EST #
I guess the font for this weblog is called "impact"?
I vote to change it to anything else. Helvetica? Courier?
My preference is for plain and simple (like me.)
Posted by jon soons on December 18, 2008 at 01:12 PM EST #