version 1.3, 2002/08/12 17:22:04
|
version 1.4, 2002/09/05 17:36:39
|
Line 50 Scott Harrison, sharrison@users.sourcefo
|
Line 50 Scott Harrison, sharrison@users.sourcefo
|
|
|
=cut |
=cut |
|
|
|
# =================================================== READ IN COMMAND ARGUMENTS |
|
# ---------------------------------------------------- Process download option. |
|
my $download=shift(@ARGV); |
|
if ($download eq '--download') |
|
{ |
|
if ($< != 0) # Download mode requires 'root'. |
|
{ |
|
print('**** ERROR **** Download mode needs to be run as root'."\n"); |
|
exit(1); # Exit with error status. |
|
} |
|
`rm -Rf /tmp/loncapa_rpm_updates`; |
|
$download='-v -dl -d /tmp/loncapa_rpm_updates'; # Part of check-rpms args. |
|
} |
|
else |
|
{ |
|
$download=''; |
|
} |
|
|
# =================================================== GENERAL INITIAL VARIABLES |
# =================================================== GENERAL INITIAL VARIABLES |
# ---------------- The FTP servers (and their directory paths) to check against |
# ---------------- The FTP servers (and their directory paths) to check against |
my @serverpaths_to_try=( |
my @serverpaths_to_try=( |
Line 60 my @serverpaths_to_try=(
|
Line 78 my @serverpaths_to_try=(
|
'opnsrc.support.compaq.com/linux/redhat/updates.redhat.com/', |
'opnsrc.support.compaq.com/linux/redhat/updates.redhat.com/', |
); |
); |
|
|
|
# --------------------------------------------------- Determine RedHat version. |
my $RHversion = (split /\s/, `cat /etc/redhat-release`)[4]; # - 6.2 or 7.3 or ? |
my $RHversion = (split /\s/, `cat /etc/redhat-release`)[4]; # - 6.2 or 7.3 or ? |
my $checkcommand='check-rpms -ftp '; # -------- use check-rpms command this way |
|
|
# ------------------------------------------- Use check-rpms command this way. |
|
my $checkcommand='check-rpms '.$download.' --rpmuser www -ftp'; |
|
|
my $FTPSERVER; # ------------------------- the server portion of the serverpath |
my $FTPSERVER; # ------------------------- the server portion of the serverpath |
my $FTPUPDATES; # ----------------------------- the actual update root location |
my $FTPUPDATES; # ----------------------------- the actual update root location |
Line 92 SERVERLOOP: foreach my $serverpath (@ser
|
Line 113 SERVERLOOP: foreach my $serverpath (@ser
|
$serverpath=~/^(.*?)\//; |
$serverpath=~/^(.*?)\//; |
$FTPSERVER=$1; |
$FTPSERVER=$1; |
print "Trying $FTPSERVER...\n"; |
print "Trying $FTPSERVER...\n"; |
`ping -q -c 1 $FTPSERVER 2>/dev/null`; |
`ping -c 1 $FTPSERVER 2>/dev/null`; |
if ($?==0) { |
if ($?==0) { |
|
print "$FTPSERVER found...\n"; |
`ncftpls ftp://$FTPSERVER`; |
`ncftpls ftp://$FTPSERVER`; |
if ($?==0) { |
if ($?==0) { |
$FTPUPDATES="$serverpath$RHversion/en/os"; |
$FTPUPDATES="$serverpath$RHversion/en/os"; |
print "$checkcommand $FTPUPDATES\n"; |
print "$checkcommand $FTPUPDATES\n"; |
@rpms=`$checkcommand $FTPUPDATES`; |
if ($download) { |
|
$|=1; |
|
print `$checkcommand $FTPUPDATES 2>\&1`; |
|
exit(0); |
|
} |
|
@rpms=`$checkcommand $FTPUPDATES 2>\&1`; |
my $rpmtext=join('',@rpms); |
my $rpmtext=join('',@rpms); |
|
if ($rpmtext=~/You do not seem to have a/) { |
|
print "You do not have a 'www' user on your system.\n". |
|
"Please add this user and try this command again.\n"; |
|
exit(1); |
|
} |
if ($rpmtext=~/This account is currently not/) { # ---------- uh-oh |
if ($rpmtext=~/This account is currently not/) { # ---------- uh-oh |
print "...strange error, moving on ($FTPSERVER)\n"; |
print "...strange error, moving on ($FTPSERVER)\n"; |
} |
} |
Line 129 elsif ($reallygoodoutput) {
|
Line 161 elsif ($reallygoodoutput) {
|
else { |
else { |
my $rpmcount=scalar(@rpms); |
my $rpmcount=scalar(@rpms); |
print(<<END); |
print(<<END); |
**** WARNING **** You need to update at least $rpmcount RPMS shown in |
**** WARNING **** You need to update at least $rpmcount RPMS shown in |
the list below. THIS IS IMPORTANT FOR SECURITY. |
the list below. THIS IS IMPORTANT FOR SECURITY. |
|
|
END |
END |
Line 140 Please visit ftp://$FTPUPDATES
|
Line 172 Please visit ftp://$FTPUPDATES
|
and download the RPMS you need. |
and download the RPMS you need. |
For instructions on working with (and upgrading) RPMS, please |
For instructions on working with (and upgrading) RPMS, please |
visit http://www.rpm.org/max-rpm/. |
visit http://www.rpm.org/max-rpm/. |
|
To automatically download these RPMs to /tmp/loncapa_rpm_updates/, |
|
run the CHECKRPMS command as "./CHECKRPMS --download" |
END |
END |
} |
} |