summaryrefslogtreecommitdiffstats
path: root/lib/App/BorgRestore
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2017-04-02 22:07:56 +0200
committerFlorian Pritz <bluewind@xinu.at>2017-04-02 22:31:49 +0200
commit286751abf9661a93d3d1de53df98c06ea4c3ddb7 (patch)
treeddbc335e505efd891f64e8bda60895107b5fdf75 /lib/App/BorgRestore
parent7988bf4796a63c0fa233e7b462b58612cc90bb42 (diff)
downloadApp-BorgRestore-286751abf9661a93d3d1de53df98c06ea4c3ddb7.tar.gz
App-BorgRestore-286751abf9661a93d3d1de53df98c06ea4c3ddb7.tar.xz
Call borg with repo path instead of setting BORG_REPO
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'lib/App/BorgRestore')
-rw-r--r--lib/App/BorgRestore/Borg.pm9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/App/BorgRestore/Borg.pm b/lib/App/BorgRestore/Borg.pm
index 8b4e953..38c12ae 100644
--- a/lib/App/BorgRestore/Borg.pm
+++ b/lib/App/BorgRestore/Borg.pm
@@ -7,10 +7,13 @@ use IPC::Run qw(run start new_chunker);
sub new {
my $class = shift;
+ my $borg_repo = shift;
my $self = {};
bless $self, $class;
+ $self->{borg_repo} = $borg_repo;
+
return $self;
}
@@ -18,7 +21,7 @@ sub borg_list {
my $self = shift;
my @archives;
- run [qw(borg list)], '>', \my $output or die "borg list returned $?";
+ run [qw(borg list), $self->{borg_repo}], '>', \my $output or die "borg list returned $?";
for (split/^/, $output) {
if (m/^([^\s]+)\s/) {
@@ -35,7 +38,7 @@ sub restore {
my $archive_name = shift;
my $path = shift;
- system(qw(borg extract -v --strip-components), $components_to_strip, "::".$archive_name, $path);
+ system(qw(borg extract -v --strip-components), $components_to_strip, $self->{borg_repo}."::".$archive_name, $path);
}
sub list_archive {
@@ -43,7 +46,7 @@ sub list_archive {
my $archive = shift;
my $cb = shift;
- open (my $fh, '-|', 'borg', qw/list --list-format/, '{isomtime} {path}{NEWLINE}', "::".$archive);
+ open (my $fh, '-|', 'borg', qw/list --list-format/, '{isomtime} {path}{NEWLINE}', $self->{borg_repo}."::".$archive);
while (<$fh>) {
$cb->($_);
}