summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2016-08-15 15:50:56 +0200
committerFlorian Pritz <bluewind@xinu.at>2016-08-15 15:50:56 +0200
commit30d1c6b2e817515cd83e6725b56ff760e8836eff (patch)
tree693d49261a8e5b4e4782c25b5180686a1b2514de
parent10cb448218bdbfeaf692063758e09b70fdc837ec (diff)
downloadbin-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-xborg-restore.pl8
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 {