--- loncom/build/CHECKRPMS 2006/10/03 00:34:59 1.1 +++ loncom/build/CHECKRPMS 2006/10/10 19:27:48 1.6 @@ -80,7 +80,7 @@ if ($distro =~ /^fedora\d+$/) { $cmd = 'yum update'; &prepare_msg($tmpfile,$cmd); ($send,$addsubj) = &check_with_yum($tmpfile); -} elsif ($distro =~ /^(suse|sles)9\.\d$/) { +} elsif ($distro =~ /^(suse|sles)9\.?\d?$/) { $cmd = 'you'; &prepare_msg($tmpfile,$cmd); ($send,$addsubj) = &check_with_you($tmpfile); @@ -113,7 +113,7 @@ $cmd 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 @@ sub check_with_you { 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=; 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 = ; + 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; @@ -181,13 +198,20 @@ sub check_with_up2date { if (open (PIPE, "$up2date -l 2>&1 |")) { my @result=; close(PIPE); + my $output; + foreach my $line (@result) { + if ($line =~ /^The following Packages were marked to be skipped by your configuration:/) { + last; + } else { + $output .= $line; + } + } if (@result > 0) { - my $output = join('',@result); if ($output =~ /Fetching Obsoletes list/) { $up2date_error = 0; if ($output =~ /Name\s+Version\s+Rel\s+[\n\r\f]+\-+[\n\r\f]+(.+)/s) { my $packagelist = $1; - unless (($packagelist =~ /^The following Packages were marked to be skipped by your configuration:/) || ($packagelist eq '')) { + if ($packagelist ne '' && $packagelist !~ /^[\s\n\r\f]+$/) { open(TMPFILE,">>$tmpfile"); print TMPFILE $packagelist; close(TMPFILE); @@ -218,10 +242,21 @@ sub check_with_rug { chomp(@output); my @clean_output; foreach my $line (@output) { - if ($line eq 'Waking up ZMD...' || $line eq 'Done') { + if ($line =~ /^Waking\sup\sZMD\.\.\./) { next; - } - if ($line eq 'No updates are available.') { + } elsif ($line eq 'Done') { + next; + } elsif ($line eq '') { + next; + } elsif ($line eq 'The following packages will be installed:') { + next; + } elsif ($line eq 'Resolving Dependencies...') { + next; + } elsif ($line eq 'Transaction...') { + last; + } elsif ($line eq 'No updates are available.') { + last; + } elsif ($line eq 'Downloading Packages...') { last; } else { push(@clean_output,$line);