diff options
author | Florian Pritz <bluewind@xinu.at> | 2017-11-21 19:52:03 +0100 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2017-11-21 20:06:19 +0100 |
commit | c97d2a9e42fcb74b05b1473c24f849e5e2e995d8 (patch) | |
tree | 8cefafd8cd4e9e92d5caf372014157755435c72c /lib/App | |
parent | 0ed455830d1d55e39b895388539200480c928776 (diff) | |
download | App-BorgRestore-c97d2a9e42fcb74b05b1473c24f849e5e2e995d8.tar.gz App-BorgRestore-c97d2a9e42fcb74b05b1473c24f849e5e2e995d8.tar.xz |
Borg: Extract version information for future use
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'lib/App')
-rw-r--r-- | lib/App/BorgRestore/Borg.pm | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/App/BorgRestore/Borg.pm b/lib/App/BorgRestore/Borg.pm index 31511de..9807700 100644 --- a/lib/App/BorgRestore/Borg.pm +++ b/lib/App/BorgRestore/Borg.pm @@ -28,9 +28,26 @@ method new($class: $borg_repo) { $self->{borg_repo} = $borg_repo; + $self->{borg_version} = $self->borg_version(); + return $self; } +=head3 borg_version + +Return the version of borg. + +=cut + +method borg_version() { + run [qw(borg --version)], ">", \my $output or die $log->error("Failed to determined borg version")."\n"; + if ($output =~ m/^.* ([0-9.a-z]+)$/) { + return $1; + } + die $log->error("Unable to extract borg version from borg --version output")."\n"; +} + + method borg_list() { my @archives; |