diff options
author | Florian Pritz <bluewind@xinu.at> | 2016-08-15 15:50:56 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2016-08-15 15:50:56 +0200 |
commit | 30d1c6b2e817515cd83e6725b56ff760e8836eff (patch) | |
tree | 693d49261a8e5b4e4782c25b5180686a1b2514de | |
parent | 10cb448218bdbfeaf692063758e09b70fdc837ec (diff) | |
download | bin-30d1c6b2e817515cd83e6725b56ff760e8836eff.tar.gz bin-30d1c6b2e817515cd83e6725b56ff760e8836eff.tar.xz |
borg-restore.pl: Implement actual restoration of backup
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rwxr-xr-x | borg-restore.pl | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/borg-restore.pl b/borg-restore.pl index d15f217..bfdc58c 100755 --- a/borg-restore.pl +++ b/borg-restore.pl @@ -265,6 +265,7 @@ sub restore { printf "Restoring %s to %s from archive %s\n", $path, $destination, $archive->{archive}; my $basename = basename($path); + my $final_destination = abs_path($basename); my $components_to_strip =()= $path =~ /\//g; debug(sprintf("CWD is %s", getcwd())); @@ -272,10 +273,9 @@ sub restore { mkdir($destination) unless -d $destination; chdir($destination) or die "Failed to chdir: $!"; - # FIXME this doesn't behave as per docs yet - debug("Removing ".abs_path($basename)); - #File::Path::remove_tree("restore-test"); - system(qw(echo borg extract -v --strip-components), $components_to_strip, "::".$archive->{archive}, $path); + debug("Removing ".$final_destination); + File::Path::remove_tree($final_destination); + system(qw(borg extract -v --strip-components), $components_to_strip, "::".$archive->{archive}, $path); } sub get_cache_dir { |