summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/App/BorgRestore/Settings.pm73
-rwxr-xr-xscript/borg-restore.pl58
2 files changed, 74 insertions, 57 deletions
diff --git a/lib/App/BorgRestore/Settings.pm b/lib/App/BorgRestore/Settings.pm
index 2aa24ad..564d0f8 100644
--- a/lib/App/BorgRestore/Settings.pm
+++ b/lib/App/BorgRestore/Settings.pm
@@ -8,6 +8,79 @@ use App::BorgRestore::Helper;
use File::Path qw(mkpath);
use Sys::Hostname;
+=encoding utf-8
+
+=head1 NAME
+
+App::BorgRestore::Settings - Settings package
+
+=head1 DESCRIPTION
+
+App::BorgRestore::Settings searches for configuration files in the following locations in
+order. The first file found will be used, any later ones are ignored. If no
+files are found, defaults are used.
+
+=over
+
+=item * $XDG_CONFIG_HOME/borg-restore.cfg
+
+=item * /etc/borg-restore.cfg
+
+=back
+
+=head2 Configuration Options
+
+You can set the following options in the config file.
+
+Note that the configuration file is parsed as a perl script. Thus you can also
+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.
+
+=item C<@backup_prefixes>
+
+This is an array of prefixes that need to be added when looking up a file in the
+backup archives. If you use filesystem snapshots and the snapshot for /home is
+located at /mnt/snapshots/home, you have to add the following:
+
+# In the backup archives, /home has the path /mnt/snapshots/home
+{regex => "^/home/", replacement => "mnt/snapshots/home/"},
+
+The regex must always include the leading slash and it is suggested to include
+a tailing slash as well to prevent clashes with directories that start with the
+same string. The first regex that matches for a given file is used. This
+setting only affects lookups, it does not affect the creation of the database
+with --update-database.
+
+=back
+
+=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/"},
+ # /boot is not snapshotted
+ {regex => "^/boot", replacement => ""},
+ {regex => "^/", replacement => "mnt/snapshots/root/"},
+ );
+
+=head1 LICENSE
+
+Copyright (C) 2016-2017 Florian Pritz E<lt>bluewind@xinu.atE<gt>
+
+See LICENSE for the full license text.
+
+=cut
our $borg_repo = "backup:borg-".hostname;
our $cache_path_base = sprintf("%s/borg-restore.pl", $ENV{XDG_CACHE_HOME} // $ENV{HOME}."/.cache");
our @backup_prefixes = (
diff --git a/script/borg-restore.pl b/script/borg-restore.pl
index 7093391..ded825e 100755
--- a/script/borg-restore.pl
+++ b/script/borg-restore.pl
@@ -74,63 +74,7 @@ s (seconds), min (minutes), h (hours), d (days), m (months = 31 days), y (year).
=head1 CONFIGURATION
-borg-restore.pl searches for configuration files in the following locations in
-order. The first file found will be used, any later ones are ignored. If no
-files are found, defaults are used.
-
-=over
-
-=item * $XDG_CONFIG_HOME/borg-restore.cfg
-
-=item * /etc/borg-restore.cfg
-
-=back
-
-=head2 Configuration Options
-
-You can set the following options in the config file.
-
-Note that the configuration file is parsed as a perl script. Thus you can also
-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.
-
-=item C<@backup_prefixes>
-
-This is an array of prefixes that need to be added when looking up a file in the
-backup archives. If you use filesystem snapshots and the snapshot for /home is
-located at /mnt/snapshots/home, you have to add the following:
-
-# In the backup archives, /home has the path /mnt/snapshots/home
-{regex => "^/home/", replacement => "mnt/snapshots/home/"},
-
-The regex must always include the leading slash and it is suggested to include
-a tailing slash as well to prevent clashes with directories that start with the
-same string. The first regex that matches for a given file is used. This
-setting only affects lookups, it does not affect the creation of the database
-with --update-database.
-
-=back
-
-=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/"},
- # /boot is not snapshotted
- {regex => "^/boot", replacement => ""},
- {regex => "^/", replacement => "mnt/snapshots/root/"},
- );
+For configuration options please see L<App::BorgRestore::Settings>.
=head1 LICENSE