projects
/
BackupPC.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
a53b565
)
make md5sums read-only
author
Dobrica Pavlinusic
<dpavlin@rot13.org>
Sat, 29 Jan 2011 14:54:49 +0000
(15:54 +0100)
committer
Dobrica Pavlinusic
<dpavlin@rot13.org>
Sat, 29 Jan 2011 14:54:49 +0000
(15:54 +0100)
bin/BackupPC_ASA_PostArchive_Update
patch
|
blob
|
history
diff --git
a/bin/BackupPC_ASA_PostArchive_Update
b/bin/BackupPC_ASA_PostArchive_Update
index
475a477
..
93478c9
100755
(executable)
--- a/
bin/BackupPC_ASA_PostArchive_Update
+++ b/
bin/BackupPC_ASA_PostArchive_Update
@@
-120,6
+120,13
@@
my $sth_inc_size = $dbh->prepare(qq{
where id = ?
});
where id = ?
});
+sub read_only {
+ my $full = shift;
+ my $perm = (stat $full)[2] & 0444;
+ warn sprintf("chmod %03o %s\n",$perm,$full);
+ chmod $perm, $full || die $!;
+}
+
sub check_archive {
my ($host,$num) = @_;
warn "# check_archive $host $num";
sub check_archive {
my ($host,$num) = @_;
warn "# check_archive $host $num";
@@
-144,6
+151,7
@@
sub check_archive {
if ( ! -e $md5_path ) {
system_ok "cd $Conf{ArchiveDest} && /usr/bin/md5sum $host.$num.* > $md5_path";
if ( ! -e $md5_path ) {
system_ok "cd $Conf{ArchiveDest} && /usr/bin/md5sum $host.$num.* > $md5_path";
+ read_only $md5_path;
$read_protect = 1;
} else {
system_ok "cd $Conf{ArchiveDest} && /usr/bin/md5sum -c $md5_path" if $opt->check;
$read_protect = 1;
} else {
system_ok "cd $Conf{ArchiveDest} && /usr/bin/md5sum -c $md5_path" if $opt->check;
@@
-153,12
+161,7
@@
sub check_archive {
foreach ( split(/\n/, read_file "$Conf{ArchiveDest}/$host.$num.md5" ) ) {
my ( $md5, $path ) = split(/\s+/,$_);
$md5sum->{$path} = $md5;
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;
- }
+ read_only "$Conf{ArchiveDest}/$path" if $read_protect;
}
# depending on expected returned value this is used like:
}
# depending on expected returned value this is used like: