Diff for /loncom/configuration/Checksumming.pm between versions 1.6 and 1.7

version 1.6, 2013/06/29 16:59:09 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 2>&1 |")) {          if (open($dirh,"grep '$revtag' $pathstr 2>&1 |")) {
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);

Removed from v.1.6  
changed lines
  Added in v.1.7


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>