Added option to skip config generation
This commit is contained in:
parent
d8b355fa69
commit
792b0922dd
@ -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_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_CONFIG=0 # Set to 1 to override the existing borgmatic configuration file
|
||||||
OVERRIDE_REPOSITORY=0 # Set to 1 to override the existing backup repository
|
OVERRIDE_REPOSITORY=0 # Set to 1 to override the existing backup repository
|
||||||
|
SKIP_CONFIG=0 # Set to 1 to skip the borgmatic configuration
|
||||||
|
|
||||||
# constants
|
# constants
|
||||||
readonly SCRIPT_NAME="Borgmatic Backup Setup Tool"
|
readonly SCRIPT_NAME="Borgmatic Backup Setup Tool"
|
||||||
readonly SCRIPT_AUTHOR="Zion Networks at admin@zion-networks.de"
|
readonly SCRIPT_AUTHOR="Zion Networks at admin@zion-networks.de"
|
||||||
readonly SCRIPT_SUPPORT="admin@zion-networks.de"
|
readonly SCRIPT_SUPPORT="admin@zion-networks.de"
|
||||||
readonly VERSION="1.2.1"
|
readonly VERSION="1.2.2"
|
||||||
|
|
||||||
# logging functions
|
# logging functions
|
||||||
function inf {
|
function inf {
|
||||||
@ -474,6 +475,10 @@ while [[ $# -gt 0 ]]; do
|
|||||||
OVERRIDE_CONFIG=1
|
OVERRIDE_CONFIG=1
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
-k|--skip-config)
|
||||||
|
SKIP_CONFIG=1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
-r|--override-repository)
|
-r|--override-repository)
|
||||||
OVERRIDE_REPOSITORY=1
|
OVERRIDE_REPOSITORY=1
|
||||||
shift
|
shift
|
||||||
@ -491,11 +496,11 @@ while [[ $# -gt 0 ]]; do
|
|||||||
fi
|
fi
|
||||||
inf "Options:"
|
inf "Options:"
|
||||||
inf " -a, --auto: Enable automatic, non-interactive mode"
|
inf " -a, --auto: Enable automatic, non-interactive mode"
|
||||||
inf " -n, --no-upgrade: Skip package upgrades"
|
|
||||||
inf " -d, --debug: Enable debug mode"
|
inf " -d, --debug: Enable debug mode"
|
||||||
inf " -f, --first-backup: Run the first backup after setup"
|
inf " -f, --first-backup: Run the first backup after setup"
|
||||||
inf " -o, --override-crontab: Override the existing crontab file"
|
inf " -o, --override-crontab: Override the existing crontab file"
|
||||||
inf " -c, --override-config: Override the existing borgmatic configuration 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 " -r, --override-repository: Override the existing backup repository"
|
||||||
inf " -s, --upgrade-required: Upgrade only required packages"
|
inf " -s, --upgrade-required: Upgrade only required packages"
|
||||||
inf " -u, --upgrade-all: Upgrade all installed 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
|
# 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
|
if [ -f $BORGMATIC_CONFIG_FILE ] && [ $OVERRIDE_CONFIG -ne 1 ]; then
|
||||||
err "A borgmatic configuration file already exists at $BORGMATIC_CONFIG_FILE."
|
if [ $SKIP_CONFIG -eq 1 ]; then
|
||||||
err "Please remove the existing configuration file or use the --override-config option."
|
wrn "Skipping borgmatic configuration setup."
|
||||||
exit 1
|
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
|
elif [ -f $BORGMATIC_CONFIG_FILE ] && [ $OVERRIDE_CONFIG -eq 1 ]; then
|
||||||
wrn "Existing borgmatic configuration file will be overridden!"
|
wrn "Existing borgmatic configuration file will be overridden!"
|
||||||
fi
|
fi
|
||||||
|
Reference in New Issue
Block a user