Archive for June, 2009

Installing Solaris patches on top of a tarball.

Wednesday, June 3rd, 2009

There are times when you have a copy of some Solaris packages installed, but the pkg database is not available.  This can happen when you relocate the installation directory manually, or if you’ve placed the files on a non-Solaris NFS server, or if you backed up your /opt directory, and restored it aftera complete OS reinstall.  So what happens if you want to update your software with the latest Solaris patches?  It’s actually not too hard to tear apart a Solaris patch and get at the files, so I wrote a script to help out in these situations.

The script can compare your install directory with a patch to see if the files in the patch match the versions in your install directory.  It can also install the files from the patch into your install directory. The patch arguments can be either zip files or unzipped patch directories.

This checks if any patches look like they’re not applied.

% patchraw -n DIR PATCH PATCH ....

This installs all files in all patches

% patchraw DIR PATCH PATCH ...

I developed the script using the sparc version of Sun Studio 12 as an example, and did no other testing.  So caveat emptor.  If you want to use the script, make a backup copy of the install tree.  There are some comments in the source, and some commented out print statements that might be useful.

In order to get the latest patches for Sun Studio, I recommend using the Patch Check Advanced script by Martin Paul.  You can get it here: http://www.par.univie.ac.at/solaris/pca/

The pca script is a swiss army knife for Solaris patches.  In our case we only need to make limited use of it download a set of patches. It wants to use ‘showrev’ to check your system, so you can’t run it on OpenSolaris for now.  To get the list of the latest patches available for Sun Studio, there are two ways.  There is a page listing Sun Studio 12 patches., but it can be out of date. At the time of this writing, it’s missing a locale related patch.

You can also use the pca script to download the latest index of patches and search through it.  Sun’s patch index doesn’t split out platforms very clearly, so I had to tack on some greps.  Here is the command that worked for me to find sparc patches.  This process only works if the patch synopsis follows some sort of mostly sensible convention.

% pca -l -p 'Sun Studio 12: ' total | grep -v Linux | grep -v RHEL

Put that output into a file like “patchlist”, then use pca to download the patches.  You’ll need a free login/password for the sunsolve site.

% pca -a -d patchlist
Please enter Sun Online Account User:  (your sunsolve/SDN login)
Please enter Sun Online Account Password:  (your password)

If you find this useful please drop me a line…

The script is here:  SCRIPT.

Extra Caveat: The Sun Studio 12 tarball that’s available from sun.com leaves out the performance libraries.  So installing all the patches carries the risk of installing part of the performance libraries, but not all the files.  This may cause incorrect linking of programs that try to use the performance libraries.