How do I capture and compare solaris packages

(imported topic written by SystemAdmin)

I need to check the version of Java before patching, then check again after to compare if the version changed

I think specifically this package could be used for comparison, write it to a file, then run again after doing a full patch cluster (10_Recommended). Need to know how to read the output and compare file contents befer to after and take some action or send an email

uxwks201:/

root # pkginfo -l SUNWj3rt

PKGINST: SUNWj3rt

NAME: J2SDK 1.4 runtime environment

CATEGORY: system

ARCH: sparc

VERSION: 1.4.2,REV=2004.06.03.23.51

BASEDIR: /usr

VENDOR: Sun Microsystems, Inc.

DESC: Java virtual machine and core class libraries

PSTAMP: j2se-sparc20040603235151

INSTDATE: Sep 12 2008 11:15

HOTLINE: Please contact your local service provider

STATUS: completely installed

FILES: 683 installed pathnames

7 shared pathnames

68 directories

59 executables

120430 blocks used (approx)

(imported comment written by NoahSalzman)

Do you have the Patches for Solaris site? Search for “Sun Java Web Console Patch” for an example of the “BigFixian Way” to do this.

Basically, you have a Relevance condition that checks for the “need to be patched” and then simply execute the patch if you need it. If the machine ever becomes Relevant again then it will show the need to be patched again (or you can make the Action a “policy” by never letting it expire in which case the machine will be patched automatically).

The Fixlet I mentioned uses this Relevance which you will need to modify for your specific version:

(((exists pkginfo “SUNWmcon” of it AND version of pkginfo “SUNWmcon” of it contains “2.2.2,REV=2005.01.09.23.05”) OR (exists pkginfo “SUNWmcos” of it AND version of pkginfo “SUNWmcos” of it contains “2.2.2,REV=2005.01.09.23.05”) OR (exists pkginfo “SUNWmcosx” of it AND version of pkginfo “SUNWmcosx” of it contains “2.2.2,REV=2005.01.09.23.05”) OR (exists pkginfo “SUNWmctag” of it AND version of pkginfo “SUNWmctag” of it contains “2.2.2,REV=2005.01.09.23.05”)) AND (not exists patch “121211” of it OR greatest revision of patch “121211” of it < ")) of pkgdb

A simplified, but less robust, version of that might be (I have not run this on Solaris myself, I’m just guessing):

(exists pkginfo “SUNWj3rt” of it AND version of pkginfo “SUNWj3rt” of it contains “1.4.2,REV=2004.06.03.23.51”) of pkgdb