aboutsummaryrefslogtreecommitdiff
path: root/borger
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2018-05-26 10:10:20 -0300
committerSilvio Rhatto <rhatto@riseup.net>2018-05-26 10:10:20 -0300
commiteedb6325a935fcf3b5ab9de12d87b5e9f2e429d6 (patch)
treea57f5d919a959408cf522ed756ec3f9061d682fe /borger
parent50d5e5743dc94945f32c916ee3b37356d7a6b8af (diff)
downloadborger-eedb6325a935fcf3b5ab9de12d87b5e9f2e429d6.tar.gz
borger-eedb6325a935fcf3b5ab9de12d87b5e9f2e429d6.tar.bz2
Support for multiple configuration profiles
Diffstat (limited to 'borger')
-rwxr-xr-xborger28
1 files changed, 21 insertions, 7 deletions
diff --git a/borger b/borger
index 881fa03..8fe8e6d 100755
--- a/borger
+++ b/borger
@@ -27,6 +27,7 @@ function fatal {
exit 1;
}
+# Display usage
function borger_usage {
echo "usage: $BASENAME <destination> [--continuous|--list]"
echo -n "available destinations from $BASE_CONFIG: "
@@ -34,8 +35,25 @@ function borger_usage {
exit 1
}
-# Config
+# Process configuration
function borger_config {
+ if [ ! -e "$CONFIG" ]; then
+ fatal "No such config $CONFIG"
+ elif [ -d "$CONFIG" ]; then
+ info "Multiple destination \"$DESTINATION\" found. Processing each subconfig..."
+
+ # Config is a folder, so we iterate over all items
+ # and call borger for each config
+ for config in `ls $CONFIG`; do
+ info "Calling borger for $DESTINATION/$config..."
+ $FULLNAME $DESTINATION/$config $OPTION
+ done
+
+ # Since we dispatched everything to subprocesses,
+ # there's nothing to do here.
+ exit
+ fi
+
# Ensure we have an username
if [ -z "$USER" ]; then
USER="`whoami`"
@@ -56,11 +74,7 @@ function borger_config {
PLACEHOLDER="{user}"
INTERVAL="1h"
- if [ -e "$CONFIG" ] ; then
- source $CONFIG
- else
- fatal "No such config $CONFIG"
- fi
+ source $CONFIG
# Setting this, so the repo does not need to be given on the commandline:
if [ -z "$BORG_REPO" ]; then
@@ -187,7 +201,7 @@ elif [ -z "$OPTION" ]; then
borger_run
elif [ "$OPTION" == "--list" ]; then
borger_config
- borger_check
+ borger_list
elif [ "$OPTION" == "--continuous" ]; then
borger_config