Tag Archives: system administration

Quick diff of Solaris patch levels

Suppose you have two Solaris machines and you want to bring them to the same patch level.  Or you are troubleshooting issues on two machines that are supposed to be identical.  I wrote a perl script that compares patch levels on two machines.

It shows something like this:

malfunction % patch_diff sr-host-01 sr-host-02
 
Patches on each system that are missing from the other.
                        sr-host-01  |  sr-host-02
          Wed Jun  2 11:40:40 2010  |  Wed Jun  2 11:40:59 2010
------------------------------------+-------------------------------------
                         118814-01  |  123252-01
                         118959-03  |  127752-01
                         119090-31  |  137110-01
                                    |  142430-01
                                    |  142436-01
 
Patches on each system that are downrev on the other.
                        sr-host-01  |  sr-host-02
          Wed Jun  2 11:40:40 2010  |  Wed Jun  2 11:40:59 2010
------------------------------------+-------------------------------------
                         137147-04  |  137147-05
                         137000-03  |  137000-06
                         125952-18  |  125952-19

Download patch_diff

First it shows all the patches sr-host-01 has that sr-host-02 does not have and vice-versa.  In this simplified case sr-host-01 has 3 patches sr-host-02 does not have and sr-host-02 has 5 patches sr-host-01 does not have.  It also compares patch revisions and shows the different levels on each host.  The machines share 3 patches that are at different revision levels.

To use patch_diff you must first generate a patch list on each machine.

0 sr-host-01 % patch_diff -g

This makes a directory with a NDBM file containing the patches on sr-host-01. Do the same for sr-host-02 and bring the NDBM files together. (It helps if your home directory is shared between the machines.)

0 malfunction % ls patch_diff
sr-host-01.dir  sr-host-02.dir
sr-host-01.pag  sr-host-02.pag

Download patch_diff