This allows operator errors in re-running dumps which have
archives allready created, and it seems that pigz produce
some amount of fuzzing in archive creation, so md5sums
of re-created archives don't match any more (which is bad
since we stored them in database for export to CD/DVD image)
my $md5_path = "$Conf{ArchiveDest}/$host.$num.md5";
unlink $md5_path if -s $md5_path == 0; # fix empty
+ my $read_protect = 0;
+
if ( ! -e $md5_path ) {
system_ok "cd $Conf{ArchiveDest} && /usr/bin/md5sum $host.$num.* > $md5_path";
+ $read_protect = 1;
} else {
system_ok "cd $Conf{ArchiveDest} && /usr/bin/md5sum -c $md5_path" if $opt->check;
}
foreach ( split(/\n/, read_file "$Conf{ArchiveDest}/$host.$num.md5" ) ) {
my ( $md5, $path ) = split(/\s+/,$_);
$md5sum->{$path} = $md5;
+ if ( $read_protect ) {
+ my $full = "$Conf{ArchiveDest}/$path";
+ my $perm = (stat $full)[2] & 0444;
+ warn sprintf("chmod %03o %s\n",$perm,$full);
+ chmod $perm, $full;
+ }
}
# depending on expected returned value this is used like: