aboutsummaryrefslogtreecommitdiff
path: root/borger
diff options
context:
space:
mode:
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