summaryrefslogtreecommitdiffstats
path: root/ldap/systools/getSolPatches.pl
diff options
context:
space:
mode:
authorcvsadm <cvsadm>2005-01-21 00:44:34 +0000
committercvsadm <cvsadm>2005-01-21 00:44:34 +0000
commitb2093e3016027d6b5cf06b3f91f30769bfc099e2 (patch)
treecf58939393a9032182c4fbc4441164a9456e82f8 /ldap/systools/getSolPatches.pl
downloadds-ldapserver7x.tar.gz
ds-ldapserver7x.tar.xz
ds-ldapserver7x.zip
Moving NSCP Directory Server from DirectoryBranch to TRUNK, initial drop. (foxworth)ldapserver7x
Diffstat (limited to 'ldap/systools/getSolPatches.pl')
-rwxr-xr-xldap/systools/getSolPatches.pl64
1 files changed, 64 insertions, 0 deletions
diff --git a/ldap/systools/getSolPatches.pl b/ldap/systools/getSolPatches.pl
new file mode 100755
index 00000000..7b463fef
--- /dev/null
+++ b/ldap/systools/getSolPatches.pl
@@ -0,0 +1,64 @@
+#!/usr/bin/perl -w
+
+$patchdir = "/var/sadm/patch";
+
+# key is the major patch number
+# the value is a hash ref which has two keys 'iminor' and 'val'
+# the value of key 'iminor' is the minor patch number
+# the system keeps track of all revisions (minor number) for each patch (major number)
+# we only want to list the highest revision, since on Solaris higher revisions include
+# and supersede lower revisions
+# the value of key 'val' is the string to print out
+%patches = ();
+
+opendir PATCHDIR, $patchdir or die "Error: could not open $patchdir: $!: you must be superuser to run this script\n";
+while ($dir = readdir PATCHDIR) {
+ if ($dir =~ /(\d+)\-(\d+)/) {
+ $major = $1;
+ $minor = $2;
+ $iminor = int($2);
+ if (! $patches{$major} || ! $patches{$major}->{iminor} || ($patches{$major}->{iminor} < $iminor)) {
+ open IN, "$patchdir/$dir/README.$major\-$minor" or die "Error: could not open $patchdir/$dir/README.$major\-$minor: $! - you must be superuser to run this script\n";
+ while (<IN>) {
+ chop;
+ if (/^Synopsis:\s+/) {
+ $desc = $';
+ }
+ if (/^Date:\s+/) {
+ $date = $';
+ }
+ if (/^SunOS Release:\s+(\d+)\.(\d+)/) {
+ $majrel = $1;
+ $minrel = $2;
+ last;
+ }
+ }
+ $required = 1; # how to tell if patch is not required, only recommended?
+ $patches{$major}->{val} = "{$major,$iminor,$required,2$minrel,0,0,\"$date: $desc\"},\n";
+ close IN;
+ $patches{$major}->{iminor} = $iminor;
+ }
+ }
+}
+closedir PATCHDIR;
+
+$date = gmtime;
+$host = `hostname`;
+$dom = `domainname`;
+$rel = `cat /etc/release`;
+
+chomp $host;
+chomp $dom;
+chomp $date;
+print "/* This list was generated by $0 */\n";
+print "/* on $host.$dom */\n";
+print "/* at $date GMT */\n";
+print "/* Here is the information from /etc/release:\n";
+print $rel;
+print " The following is a list of patches installed on the system */\n";
+print "/* a patch that is commented out is either a duplicate or */\n";
+print "/* a patch that is superseded by another patch */\n";
+
+for $major (sort keys %patches) {
+ print $patches{$major}->{val};
+}