[csw-devel] SF.net SVN: gar:[12003] csw/mgar/pkg/cswpkgloghooks/trunk/files/ 01-CSWcswpkgloghooks-postupgrade

bdwalton at users.sourceforge.net bdwalton at users.sourceforge.net
Sat Dec 18 15:57:47 CET 2010


Revision: 12003
          http://gar.svn.sourceforge.net/gar/?rev=12003&view=rev
Author:   bdwalton
Date:     2010-12-18 14:57:47 +0000 (Sat, 18 Dec 2010)

Log Message:
-----------
cswpkgloghooks: major cleanup of the post hook script

Modified Paths:
--------------
    csw/mgar/pkg/cswpkgloghooks/trunk/files/01-CSWcswpkgloghooks-postupgrade

Modified: csw/mgar/pkg/cswpkgloghooks/trunk/files/01-CSWcswpkgloghooks-postupgrade
===================================================================
--- csw/mgar/pkg/cswpkgloghooks/trunk/files/01-CSWcswpkgloghooks-postupgrade	2010-12-18 14:23:22 UTC (rev 12002)
+++ csw/mgar/pkg/cswpkgloghooks/trunk/files/01-CSWcswpkgloghooks-postupgrade	2010-12-18 14:57:47 UTC (rev 12003)
@@ -10,15 +10,10 @@
 $pkg = $1;
 $ver = $2;
 
-$sysver = `pkgparam $pkg VERSION`;
 $statefile = "/var/opt/csw/pkg-hooks/CSWpkgloghooks.upgrade.$pkg";
 
-open(STATEFILE, ">$statefile") or die "Couldn't open $statefile.";
-print STATEFILE "$sysver";
-close(STATEFILE);
-
 sub logdie {
-    my ($arg) = (shift);
+    my($arg) = (shift);
     system('logger', '-t', 'cswpkgloghooks', $arg);
     exit 0
 }
@@ -51,7 +46,8 @@
 
 
 if ( -d "/var/sadm/pkg/$pkg" ) {
-    $sysver = system('pkgparam', $pkg, 'VERSION');
+    $sysver = `pkgparam $pkg VERSION 2>/dev/null`;
+    chomp($sysver);
 
     if ( -f "$statefile" ) {
 	open (STATEFILE, "<$statefile") or die "Couldn't open $statefile.";
@@ -61,9 +57,10 @@
     }
 
     if ($script =~ /remove$/) {
-	failure;
+	failure();
     } else {
-	if ("$ver" eq "$sysver") {
+	print "VER: $ver; SYSVER: $sysver\n";
+	if ($ver eq $sysver) {
 	    success($oldver);
 	} else {
 	    failure($sysver);


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.


More information about the devel mailing list