--- loncom/configuration/Checksumming.pm 2017/06/30 14:53:39 1.8 +++ loncom/configuration/Checksumming.pm 2023/05/15 02:31:01 1.10 @@ -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.10 2023/05/15 02:31:01 raeburn Exp $ # # The LearningOnline Network with CAPA # @@ -49,6 +49,7 @@ sub get_checksums { } if ($lonlib) { push(@paths,($lonlib.'/perl/Apache/*.pm', + $lonlib.'/perl/Apache/math_parser/*.pm, $lonlib.'/perl/Apache/localize/*.pm', $lonlib.'/perl/LONCAPA/*.pm', $lonlib.'/perl/AlgParser.pm', @@ -88,18 +89,46 @@ sub get_checksums { } 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\\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 +170,8 @@ sub compare_checksums { $numchg ++; } } else { - unless ((-e $key) && (-B $key)) { - $missing{$key} = 1; - $numchg ++; - } + $missing{$key} = 1; + $numchg ++; } } foreach my $key (keys(%{$serversums})) {