version 1.1, 2006/10/03 00:34:59
|
version 1.7, 2007/04/23 20:04:52
|
Line 39 to LON-CAPA systems. distprobe is used t
|
Line 39 to LON-CAPA systems. distprobe is used t
|
|
|
The utility which is used to complete the check depends on the distro: |
The utility which is used to complete the check depends on the distro: |
|
|
fedora - yum |
fedora, rhel 5/5+ - yum |
suse 9.X and sles9 - you |
suse 9.X and sles9 - you |
suse 10.X and sles10 - rug |
suse 10.X and sles10 - rug |
rhel 4 - up2date |
rhel 4 - up2date |
Line 80 if ($distro =~ /^fedora\d+$/) {
|
Line 80 if ($distro =~ /^fedora\d+$/) {
|
$cmd = 'yum update'; |
$cmd = 'yum update'; |
&prepare_msg($tmpfile,$cmd); |
&prepare_msg($tmpfile,$cmd); |
($send,$addsubj) = &check_with_yum($tmpfile); |
($send,$addsubj) = &check_with_yum($tmpfile); |
} elsif ($distro =~ /^(suse|sles)9\.\d$/) { |
} elsif ($distro =~ /^(suse|sles)9\.?\d?$/) { |
$cmd = 'you'; |
$cmd = 'you'; |
&prepare_msg($tmpfile,$cmd); |
&prepare_msg($tmpfile,$cmd); |
($send,$addsubj) = &check_with_you($tmpfile); |
($send,$addsubj) = &check_with_you($tmpfile); |
Line 88 if ($distro =~ /^fedora\d+$/) {
|
Line 88 if ($distro =~ /^fedora\d+$/) {
|
$cmd = 'rug up'; |
$cmd = 'rug up'; |
&prepare_msg($tmpfile,$cmd); |
&prepare_msg($tmpfile,$cmd); |
($send,$addsubj) = &check_with_rug($tmpfile); |
($send,$addsubj) = &check_with_rug($tmpfile); |
} elsif ($distro =~ /^rhes4$/) { |
} elsif ($distro =~ /^rhes(\d+)$/) { |
$cmd ='up2date -u --nox'; |
my $version = $1; |
&prepare_msg($tmpfile,$cmd); |
if ($version == 4) { |
($send,$addsubj) = &check_with_up2date($tmpfile); |
$cmd ='up2date -u --nox'; |
|
&prepare_msg($tmpfile,$cmd); |
|
($send,$addsubj) = &check_with_up2date($tmpfile); |
|
} elsif ($version > 4) { |
|
$cmd = 'yum update'; |
|
&prepare_msg($tmpfile,$cmd); |
|
($send,$addsubj) = &check_with_yum($tmpfile); |
|
} |
} else { |
} else { |
$cmd = '/usr/local/bin/check-rpms --update'; |
$cmd = '/usr/local/bin/check-rpms --update'; |
($send,$addsubj) = &check_with_checkrpms($tmpfile); |
($send,$addsubj) = &check_with_checkrpms($tmpfile); |
Line 113 $cmd
|
Line 120 $cmd
|
|
|
to bring it up to date. |
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 |
ENDHEADER |
close(TMPFILE); |
close(TMPFILE); |
Line 126 sub check_with_you {
|
Line 133 sub check_with_you {
|
my $sendflag = 0; |
my $sendflag = 0; |
my $append_to_subj; |
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>; |
my $output=<PIPE>; |
close(PIPE); |
close(PIPE); |
chomp $output; |
chomp $output; |
unless ($output eq 'No updates available.') { |
unless ($output eq 'No updates available.') { |
my $command = $you.' -s -k -l en |grep ^[^I] >>'.$tmpfile; |
if (open (PIPE, "$you -s -d -len |grep ^INSTALL |")) { |
system($command); |
my @updates = <PIPE>; |
$sendflag = 1; |
close(PIPE); |
$append_to_subj = ' RPMS to upgrade'; |
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 { |
} else { |
$sendflag = 1; |
$sendflag = 1; |
Line 181 sub check_with_up2date {
|
Line 205 sub check_with_up2date {
|
if (open (PIPE, "$up2date -l 2>&1 |")) { |
if (open (PIPE, "$up2date -l 2>&1 |")) { |
my @result=<PIPE>; |
my @result=<PIPE>; |
close(PIPE); |
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) { |
if (@result > 0) { |
my $output = join('',@result); |
|
if ($output =~ /Fetching Obsoletes list/) { |
if ($output =~ /Fetching Obsoletes list/) { |
$up2date_error = 0; |
$up2date_error = 0; |
if ($output =~ /Name\s+Version\s+Rel\s+[\n\r\f]+\-+[\n\r\f]+(.+)/s) { |
if ($output =~ /Name\s+Version\s+Rel\s+[\n\r\f]+\-+[\n\r\f]+(.+)/s) { |
my $packagelist = $1; |
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"); |
open(TMPFILE,">>$tmpfile"); |
print TMPFILE $packagelist; |
print TMPFILE $packagelist; |
close(TMPFILE); |
close(TMPFILE); |
Line 218 sub check_with_rug {
|
Line 249 sub check_with_rug {
|
chomp(@output); |
chomp(@output); |
my @clean_output; |
my @clean_output; |
foreach my $line (@output) { |
foreach my $line (@output) { |
if ($line eq 'Waking up ZMD...' || $line eq 'Done') { |
if ($line =~ /^Waking\sup\sZMD\.\.\./) { |
next; |
next; |
} |
} elsif ($line eq 'Done') { |
if ($line eq 'No updates are available.') { |
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; |
last; |
} else { |
} else { |
push(@clean_output,$line); |
push(@clean_output,$line); |