version 1.3, 2013/02/04 15:05:23
|
version 1.7, 2016/02/20 20:58:59
|
Line 34 use strict;
|
Line 34 use strict;
|
use lib '/home/httpd/lib/perl/'; |
use lib '/home/httpd/lib/perl/'; |
use Apache::lonlocal(); |
use Apache::lonlocal(); |
use Apache::loncommon(); |
use Apache::loncommon(); |
|
use Digest::SHA; |
|
|
sub get_checksums { |
sub get_checksums { |
my ($distro,$londaemons,$lonlib,$lonincludes,$lontabdir) = @_; |
my ($distro,$londaemons,$lonlib,$lonincludes,$lontabdir) = @_; |
Line 62 sub get_checksums {
|
Line 63 sub get_checksums {
|
} |
} |
push(@paths,('/home/httpd/cgi-bin/*.pl','/home/httpd/cgi-bin/*.png')); |
push(@paths,('/home/httpd/cgi-bin/*.pl','/home/httpd/cgi-bin/*.png')); |
my $confdir = '/etc/httpd/conf'; |
my $confdir = '/etc/httpd/conf'; |
my $sha = 'SHA1'; |
|
if ($distro =~ /^(ubuntu|debian)(\d+)$/) { |
if ($distro =~ /^(ubuntu|debian)(\d+)$/) { |
$confdir = '/etc/apache2'; |
$confdir = '/etc/apache2'; |
if (($1 eq 'ubuntu') && ($2 >= 12)) { |
|
$sha = 'SHA'; |
|
} |
|
} elsif ($distro =~ /^sles(\d+)$/) { |
} elsif ($distro =~ /^sles(\d+)$/) { |
if ($1 >= 10) { |
if ($1 >= 10) { |
$confdir = '/etc/apache2'; |
$confdir = '/etc/apache2'; |
Line 78 sub get_checksums {
|
Line 75 sub get_checksums {
|
} |
} |
} |
} |
push(@paths,("$confdir/loncapa_apache.conf","$confdir/startup.pl")); |
push(@paths,("$confdir/loncapa_apache.conf","$confdir/startup.pl")); |
if ($sha eq 'SHA1') { |
|
require Digest::SHA1; |
|
} else { |
|
require Digest::SHA; |
|
} |
|
if (@paths) { |
if (@paths) { |
my $pathstr = join (' ',@paths); |
my $pathstr = join (' ',@paths); |
if (open($dirh,"grep '$revtag' $pathstr |")) { |
if (open($dirh,"grep '$revtag' $pathstr 2>&1 |")) { |
while (my $line=<$dirh>) { |
while (my $line=<$dirh>) { |
if ($line =~ m{^([^#]+):#\s\\s[\w.]+,v\s([\d.]+)\s}) { |
if ($line =~ m{^([^#]+):#\s\\s[\w.]+,v\s([\d.]+)\s}) { |
$versions{$1} = $2; |
$versions{$1} = $2; |
Line 98 sub get_checksums {
|
Line 90 sub get_checksums {
|
my $sum; |
my $sum; |
if (open(my $fh,"<$key")) { |
if (open(my $fh,"<$key")) { |
binmode $fh; |
binmode $fh; |
my $sha_obj; |
my $sha_obj = Digest::SHA->new(); |
if ($sha eq 'SHA') { |
|
$sha_obj = Digest::SHA->new(); |
|
} else { |
|
$sha_obj = Digest::SHA1->new(); |
|
} |
|
$sha_obj->addfile($fh); |
$sha_obj->addfile($fh); |
$sum = $sha_obj->hexdigest; |
$sum = $sha_obj->hexdigest; |
close($fh); |
close($fh); |
Line 130 sub compare_checksums {
|
Line 117 sub compare_checksums {
|
} else { |
} else { |
$linefeed = "\n"; |
$linefeed = "\n"; |
} |
} |
|
if (!$Apache::lonlocal::lh) { |
|
&Apache::lonlocal::get_language_handle(); |
|
} |
if ((ref($serversums) eq 'HASH') && (keys(%{$serversums}))) { |
if ((ref($serversums) eq 'HASH') && (keys(%{$serversums}))) { |
my $checksums = &Apache::lonnet::fetch_dns_checksums(); |
my $checksums = &Apache::lonnet::fetch_dns_checksums(); |
my (%extra,%missing,%diffs,%stdsums,%stdversions); |
my (%extra,%missing,%diffs,%stdsums,%stdversions); |
Line 148 sub compare_checksums {
|
Line 138 sub compare_checksums {
|
$numchg ++; |
$numchg ++; |
} |
} |
} else { |
} else { |
$missing{$key} = 1; |
unless ((-e $key) && (-B $key)) { |
$numchg ++; |
$missing{$key} = 1; |
|
$numchg ++; |
|
} |
} |
} |
} |
} |
foreach my $key (keys(%{$serversums})) { |
foreach my $key (keys(%{$serversums})) { |
Line 272 sub compare_checksums {
|
Line 264 sub compare_checksums {
|
foreach my $file (sort(keys(%missing))) { |
foreach my $file (sort(keys(%missing))) { |
my $revnum = $stdversions{$file}; |
my $revnum = $stdversions{$file}; |
if ($target eq 'web') { |
if ($target eq 'web') { |
$message .= '<td>'.$file.'</td>'."\n". |
$message .= &Apache::loncommon::start_data_table_row()."\n". |
|
'<td>'.$file.'</td>'."\n". |
'<td>'.$revnum.'</td>'."\n". |
'<td>'.$revnum.'</td>'."\n". |
&Apache::loncommon::end_data_table_row()."\n"; |
&Apache::loncommon::end_data_table_row()."\n"; |
} else { |
} else { |
Line 308 sub compare_checksums {
|
Line 301 sub compare_checksums {
|
} |
} |
foreach my $file (sort(keys(%extra))) { |
foreach my $file (sort(keys(%extra))) { |
if ($target eq 'web') { |
if ($target eq 'web') { |
$message .= '<td>'.$file.'</td>'."\n". |
$message .= &Apache::loncommon::start_data_table_row()."\n". |
|
'<td>'.$file.'</td>'."\n". |
'<td>'.$serverversions->{$file}.'</td>'."\n". |
'<td>'.$serverversions->{$file}.'</td>'."\n". |
&Apache::loncommon::end_data_table_row()."\n"; |
&Apache::loncommon::end_data_table_row()."\n"; |
} else { |
} else { |