mirror of
https://github.com/ovh/the-bastion.git
synced 2024-09-20 15:05:58 +08:00
fix: osh-encrypt-rsync: delete +a source files properly
This commit is contained in:
parent
10fcb7ebc5
commit
6d3bd00d4c
|
@ -374,7 +374,16 @@ sub encrypt_multi {
|
||||||
|
|
||||||
# transient file
|
# transient file
|
||||||
_log " ... deleting transient file $current_source_file" if $verbose;
|
_log " ... deleting transient file $current_source_file" if $verbose;
|
||||||
$dryRun or unlink $current_source_file;
|
if (!$dryRun) {
|
||||||
|
if (!unlink $current_source_file) {
|
||||||
|
|
||||||
|
# maybe it is +a? try to -a it blindly and retry
|
||||||
|
system('chattr', '-a', $current_source_file);
|
||||||
|
if (!unlink $current_source_file) {
|
||||||
|
_warn "Couldn't delete transient file '$current_source_file' ($!)";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ($error) {
|
if ($error) {
|
||||||
$success = 0;
|
$success = 0;
|
||||||
|
@ -385,7 +394,16 @@ sub encrypt_multi {
|
||||||
}
|
}
|
||||||
if ($success and $remove_source_on_success) {
|
if ($success and $remove_source_on_success) {
|
||||||
_log " ... removing source file $source_file" if $verbose;
|
_log " ... removing source file $source_file" if $verbose;
|
||||||
$dryRun or unlink $source_file;
|
if (!$dryRun) {
|
||||||
|
if (!unlink $source_file) {
|
||||||
|
|
||||||
|
# maybe it is +a? try to -a it blindly and retry
|
||||||
|
system('chattr', '-a', $source_file);
|
||||||
|
if (!unlink $source_file) {
|
||||||
|
_warn "Couldn't delete source file '$source_file' ($!)";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return !$success;
|
return !$success;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue