diff options
author | Florian Pritz <bluewind@xinu.at> | 2017-02-27 00:05:30 +0100 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2017-02-27 09:56:32 +0100 |
commit | 82bdef1a323fc46ad8499ccd17d3c255200696d4 (patch) | |
tree | aec53709686cb45c57a3c752b0a1dc3bba12c2b9 /lib/App/BorgRestore/Settings.pm | |
parent | 0265a0785a266f88ae17217872badb9a53c2bea6 (diff) | |
download | App-BorgRestore-82bdef1a323fc46ad8499ccd17d3c255200696d4.tar.gz App-BorgRestore-82bdef1a323fc46ad8499ccd17d3c255200696d4.tar.xz |
Move packages to dedicated files
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'lib/App/BorgRestore/Settings.pm')
-rw-r--r-- | lib/App/BorgRestore/Settings.pm | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/App/BorgRestore/Settings.pm b/lib/App/BorgRestore/Settings.pm new file mode 100644 index 0000000..7416c54 --- /dev/null +++ b/lib/App/BorgRestore/Settings.pm @@ -0,0 +1,33 @@ +package App::BorgRestore::Settings; +use v5.10; +use strict; +use warnings; + +use App::BorgRestore::Helper; + +our $borg_repo = ""; +our $cache_path_base = sprintf("%s/borg-restore.pl", $ENV{XDG_CACHE_HOME} // $ENV{HOME}."/.cache"); +our @backup_prefixes = ( + {regex => "^/", replacement => ""}, +); + +my @configfiles = ( + sprintf("%s/borg-restore.cfg", $ENV{XDG_CONFIG_HOME} // $ENV{HOME}."/.config"), + "/etc/borg-restore.cfg", +); + +for my $configfile (@configfiles) { + $configfile = App::BorgRestore::Helper::untaint($configfile, qr/.*/); + if (-e $configfile) { + unless (my $return = do $configfile) { + die "couldn't parse $configfile: $@" if $@; + die "couldn't do $configfile: $!" unless defined $return; + die "couldn't run $configfile" unless $return; + } + } +} +$cache_path_base = App::BorgRestore::Helper::untaint($cache_path_base, qr/.*/); + +1; + +__END__ |