From 76b2760f03f8eb9fedfc99dc9455ffe7bceb51c6 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sun, 19 Feb 2017 19:47:36 +0100 Subject: borg-restore.pl: Allow to set BORG_REPO in config Signed-off-by: Florian Pritz --- borg-restore.pl | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/borg-restore.pl b/borg-restore.pl index 2735a77..58bead1 100755 --- a/borg-restore.pl +++ b/borg-restore.pl @@ -78,6 +78,11 @@ use any features available in perl itself. =over +=item C<$borg_repo> + +This specifies the URL to the borg repo as used in other borg commands. If you +use the $BORG_REPO environment variable leave this empty. + =item C<$cache_path_base> This defaults to "C<$XDG_CACHE_HOME>/borg-restore.pl". It contains the lookup database. @@ -101,6 +106,7 @@ with --update-database. =head2 Example Configuration + $borg_repo = "/path/to/repo"; $cache_path_base = "/mnt/somewhere/borg-restore.pl-cache"; @backup_prefixes = ( {regex => "^/home/", replacement => "mnt/snapshots/home/"}, @@ -132,6 +138,7 @@ use v5.10; { package Settings; + our $borg_repo = ""; our $cache_path_base = sprintf("%s/borg-restore.pl", $ENV{XDG_CACHE_HOME} // $ENV{HOME}."/.cache"); our @backup_prefixes = ( {regex => "^/", replacement => ""}, @@ -562,6 +569,8 @@ sub main { # untaint PATH because we only expect this to run as root $ENV{PATH} = Helper::untaint($ENV{PATH}, qr(.*)); + $ENV{BORG_REPO} = $Settings::borg_repo unless $Settings::borg_repo eq ""; + Getopt::Long::Configure ("bundling"); GetOptions(\%opts, "help|h", "debug", "update-cache|u", "destination|d=s", "time|t=s") or pod2usage(2); pod2usage(0) if $opts{help}; -- cgit v1.2.3-24-g4f1b