From 792b0922ddf56d1ddf5e2fd6181caf9494156210 Mon Sep 17 00:00:00 2001 From: Enrico Ludwig Date: Fri, 24 May 2024 12:41:52 +0200 Subject: [PATCH] Added option to skip config generation --- borgmatic_setup.sh | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/borgmatic_setup.sh b/borgmatic_setup.sh index b31094f..2dedf50 100755 --- a/borgmatic_setup.sh +++ b/borgmatic_setup.sh @@ -63,12 +63,13 @@ IS_REMOTE_SYNOLGY=0 # Set to 1 if the remote end is a Synology NAS OVERRIDE_CRONTAB=0 # Set to 1 to override the existing crontab file OVERRIDE_CONFIG=0 # Set to 1 to override the existing borgmatic configuration file OVERRIDE_REPOSITORY=0 # Set to 1 to override the existing backup repository +SKIP_CONFIG=0 # Set to 1 to skip the borgmatic configuration # constants readonly SCRIPT_NAME="Borgmatic Backup Setup Tool" readonly SCRIPT_AUTHOR="Zion Networks at admin@zion-networks.de" readonly SCRIPT_SUPPORT="admin@zion-networks.de" -readonly VERSION="1.2.1" +readonly VERSION="1.2.2" # logging functions function inf { @@ -474,6 +475,10 @@ while [[ $# -gt 0 ]]; do OVERRIDE_CONFIG=1 shift ;; + -k|--skip-config) + SKIP_CONFIG=1 + shift + ;; -r|--override-repository) OVERRIDE_REPOSITORY=1 shift @@ -491,11 +496,11 @@ while [[ $# -gt 0 ]]; do fi inf "Options:" inf " -a, --auto: Enable automatic, non-interactive mode" - inf " -n, --no-upgrade: Skip package upgrades" inf " -d, --debug: Enable debug mode" inf " -f, --first-backup: Run the first backup after setup" inf " -o, --override-crontab: Override the existing crontab file" inf " -c, --override-config: Override the existing borgmatic configuration file" + inf " -k, --skip-config: Skip the borgmatic configuration" inf " -r, --override-repository: Override the existing backup repository" inf " -s, --upgrade-required: Upgrade only required packages" inf " -u, --upgrade-all: Upgrade all installed packages" @@ -898,9 +903,14 @@ fi # check if borgmatic configuration file already exists and abort if $OVERRIDE_CONFIG is not set if [ -f $BORGMATIC_CONFIG_FILE ] && [ $OVERRIDE_CONFIG -ne 1 ]; then - err "A borgmatic configuration file already exists at $BORGMATIC_CONFIG_FILE." - err "Please remove the existing configuration file or use the --override-config option." - exit 1 + if [ $SKIP_CONFIG -eq 1 ]; then + wrn "Skipping borgmatic configuration setup." + wrn "Please make sure you have set up the configuration file manually." + else + err "A borgmatic configuration file already exists at $BORGMATIC_CONFIG_FILE." + err "Please remove the existing configuration file or use the --override-config option." + exit 1 + fi elif [ -f $BORGMATIC_CONFIG_FILE ] && [ $OVERRIDE_CONFIG -eq 1 ]; then wrn "Existing borgmatic configuration file will be overridden!" fi