[LON-CAPA-cvs] cvs: loncom /build CHECKRPMS

raeburn lon-capa-cvs@mail.lon-capa.org
Thu, 05 Oct 2006 21:11:25 -0000


raeburn		Thu Oct  5 17:11:25 2006 EDT

  Modified files:              
    /loncom/build	CHECKRPMS 
  Log:
  Suppress unwanted lines in rug output for SuSE 10.X, and modify parsing of online_update output for SuSE 9.X
  
  
Index: loncom/build/CHECKRPMS
diff -u loncom/build/CHECKRPMS:1.4 loncom/build/CHECKRPMS:1.5
--- loncom/build/CHECKRPMS:1.4	Thu Oct  5 13:44:38 2006
+++ loncom/build/CHECKRPMS	Thu Oct  5 17:11:25 2006
@@ -113,7 +113,7 @@
 
 to bring it up to date.
 
-This is very important for the security of your server.  The table below lists the packages which need to be updated.
+This is very important for the security of your server.  The packages which need to be updated are listed below.
 
 ENDHEADER
     close(TMPFILE);
@@ -126,15 +126,32 @@
     my $sendflag = 0;
     my $append_to_subj;
 
-    if (open (PIPE, "$you -d -k -l en 2>&1 |")) {
+    if (open (PIPE, "$you -k -len 2>&1 |")) {
         my $output=<PIPE>;
         close(PIPE);
         chomp $output;
         unless ($output eq 'No updates available.') {
-            my $command = $you.' -s  -k -l en |grep ^[^I]  >>'.$tmpfile;
-            system($command);
-            $sendflag = 1;
-            $append_to_subj = ' RPMS to upgrade';
+            if (open (PIPE, "$you -s -d -len |grep ^INSTALL |")) {
+                my @updates = <PIPE>;
+                close(PIPE);
+                my $allpackages;
+                foreach my $line (@updates) {
+                    my $package = substr($line,rindex($line,'/')+1);
+                    if ($package ne '') {
+                        $allpackages .= $package;
+                    }
+                }
+                if ($allpackages ne '') {
+                    open(TMPFILE,">>$tmpfile");
+                    print TMPFILE $allpackages;
+                    close(TMPFILE);
+                    $sendflag = 1;
+                    $append_to_subj = ' RPMS to upgrade';
+                }
+            } else {
+                $sendflag = 1;
+                $append_to_subj = ' Error running RPM update script';
+            }
         }
     } else {
         $sendflag = 1;
@@ -239,6 +256,8 @@
                 last;
             } elsif ($line eq 'No updates are available.') {
                 last;
+            } elsif ($line eq 'Downloading Packages...') {
+                last;
             } else {
                 push(@clean_output,$line);
             }