| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- #!/tools/ns/bin/perl5.6.1 -w
- # --- BEGIN COPYRIGHT BLOCK ---
- # Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
- # Copyright (C) 2005 Red Hat, Inc.
- # All rights reserved.
- #
- # License: GPL (version 3 or any later version).
- # See LICENSE for details.
- # --- END COPYRIGHT BLOCK ---
- $patchcmd = "swlist -l bundle";
- # [output sample]
- # Initializing...
- # Contacting target "linux2"...
- #
- # Target: linux2:/
- #
- #
- # B6268AA B.11.00.05 Graphics and Technical Computing Software
- # BUNDLE B.11.00 Patch Bundle
- # HPUXEng64RT B.11.00.01 English HP-UX 64-bit Runtime Environment
- # HWE1100 B.11.00.0206.5 Hardware Enablement Patches for HP-UX 11.00, June 2002
- # OnlineDiag B.11.00.21.10 HPUX 11.0 Support Tools Bundle, Jun 2002
- # QPK1100 B.11.00.64.4 Quality Pack for HP-UX 11.00, March 2004
- # UnlimUserLic B.11.00.02 HP-UX Unlimited-User License
- # XSWGR1100 B.11.00.47.08 General Release Patches, November 1999 (ACE)
- %month2digit = (
- 'January', 1,
- 'February', 2,
- 'March', 3,
- 'April', 4,
- 'May', 5,
- 'June', 6,
- 'July', 7,
- 'August', 8,
- 'September', 9,
- 'October', 10,
- 'November', 11,
- 'December', 12,
- );
- open PATCHCMD, "$patchcmd|" or die "Error: could not open $patchcmd: $!";
- sleep 1;
- $qpk_str = "";
- $month_year = "";
- while (<PATCHCMD>) {
- chop;
- if (/^\s+(QPK.*), ([A-Za-z]* [12][0-9]*)/) {
- $qpk_str = $1;
- $month_year = $2;
- }
- }
- close PATCHCMD;
- $date = gmtime;
- $host = `hostname`;
- chop $host;
- $dom = `domainname`;
- $un = `uname -a`;
- print "/* This list was generated by $0 */\n";
- print "/* on $host.$dom */\n";
- print "/* at $date GMT */\n";
- print "/* Here is the information from uname -a:\n";
- print $un;
- if ( $qpk_str eq "" )
- {
- print " Quality Pack is not installed on the system. */\n";
- }
- else
- {
- ($qpkname, $version, $description) = split(/[ ]+/, $qpk_str, 3);
- print "$qpkname\n";
- print "$version\n";
- print "$description\n";
- if ( $month_year eq "" )
- {
- print " Quality pack has no date info. */\n";
- print "$qpk_str <$month_year>\n";
- }
- else
- {
- ($month, $year) = split(/\s/, $month_year, 2);
- $mo = $month2digit{$month};
- print " The following is a Quality Pack installed on the system. */\n";
- print "{\"$qpkname\", \"$version\", \"$description\", $year, $mo, 0},\n";
- }
- }
|