[LON-CAPA-cvs] cvs: loncom /configuration Checksumming.pm
raeburn
raeburn at source.lon-capa.org
Wed Oct 24 14:16:14 EDT 2018
raeburn Wed Oct 24 18:16:14 2018 EDT
Modified files:
/loncom/configuration Checksumming.pm
Log:
- Original text file for wrapped files now checked by &compare_checksums().
Index: loncom/configuration/Checksumming.pm
diff -u loncom/configuration/Checksumming.pm:1.8 loncom/configuration/Checksumming.pm:1.9
--- loncom/configuration/Checksumming.pm:1.8 Fri Jun 30 14:53:39 2017
+++ loncom/configuration/Checksumming.pm Wed Oct 24 18:16:14 2018
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Checksum installed LON-CAPA modules and some configuration files
#
-# $Id: Checksumming.pm,v 1.8 2017/06/30 14:53:39 raeburn Exp $
+# $Id: Checksumming.pm,v 1.9 2018/10/24 18:16:14 raeburn Exp $
#
# The LearningOnline Network with CAPA
#
@@ -88,18 +88,46 @@
}
close($dirh);
}
+ if ($londaemons) {
+ my @binaries = qw (apachereload lchttpdlogs lcinstallfile lciptables lcnfsoff lcnfson lcpasswd lcuserdel pwchange);
+ foreach my $file (@binaries) {
+ next if ($versions{"$londaemons/$file"});
+ if (-B "$londaemons/$file") {
+ if (-T $londaemons.'/.'.$file) {
+ if (open(my $fh,'<',$londaemons.'/.'.$file)) {
+ while (my $line=<$fh>) {
+ if ($line =~ m{^#\s\$Id:\s[\w.]+,v\s([\d.]+)\s}) {
+ $versions{"$londaemons/$file"} = $1;
+ last;
+ }
+ }
+ close($fh);
+ }
+ if ($versions{"$londaemons/$file"}) {
+ if (open(my $fh,'<',$londaemons.'/.'.$file)) {
+ binmode $fh;
+ my $sha_obj = Digest::SHA->new();
+ $sha_obj->addfile($fh);
+ $chksums{"$londaemons/$file"} = $sha_obj->hexdigest;
+ close($fh);
+ }
+ }
+ }
+ }
+ }
+ }
foreach my $key (sort(keys(%versions))) {
next if ($key =~ /\.lpmlsave$/);
- my $sum;
- if (open(my $fh,"<$key")) {
- binmode $fh;
- my $sha_obj = Digest::SHA->new();
- $sha_obj->addfile($fh);
- $sum = $sha_obj->hexdigest;
- close($fh);
- $chksums{$key} = $sum;
+ unless (exists($chksums{$key})) {
+ if (open(my $fh,"<$key")) {
+ binmode $fh;
+ my $sha_obj = Digest::SHA->new();
+ $sha_obj->addfile($fh);
+ $chksums{$key} = $sha_obj->hexdigest;
+ close($fh);
+ }
}
- $output .= "$key,$versions{$key},$sum\n";
+ $output .= "$key,$versions{$key},$chksums{$key}\n";
}
}
if ($lontabdir ne '') {
@@ -141,10 +169,8 @@
$numchg ++;
}
} else {
- unless ((-e $key) && (-B $key)) {
- $missing{$key} = 1;
- $numchg ++;
- }
+ $missing{$key} = 1;
+ $numchg ++;
}
}
foreach my $key (keys(%{$serversums})) {
More information about the LON-CAPA-cvs
mailing list