summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2017-02-19 19:47:36 +0100
committerFlorian Pritz <bluewind@xinu.at>2017-02-19 19:47:36 +0100
commit76b2760f03f8eb9fedfc99dc9455ffe7bceb51c6 (patch)
treea81802ec0407ff3011543693afa127b4ff6e9a67
parent1b3edb9db50fc047f10f2b082becbc3de6863727 (diff)
downloadbin-76b2760f03f8eb9fedfc99dc9455ffe7bceb51c6.tar.gz
bin-76b2760f03f8eb9fedfc99dc9455ffe7bceb51c6.tar.xz
borg-restore.pl: Allow to set BORG_REPO in config
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rwxr-xr-xborg-restore.pl9
1 files changed, 9 insertions, 0 deletions
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};