diff --git a/borghelper.sh b/borghelper.sh old mode 100644 new mode 100755 index d9acb9a..6058602 --- a/borghelper.sh +++ b/borghelper.sh @@ -154,4 +154,38 @@ case "${varsFile}" in ;; esac +# verify borg base directory +if [ -z "${borgBaseDir}" ]; then + consoleError 2 "$varsFile: 'borgBaseDir' is not specified." +elif [ ! -d "${borgBaseDir}" ]; then + consoleError 2 "$varsFile: 'borgBaseDir' does not exist." +fi +export BORG_BASE_DIR="${borgBaseDir%/}" + +## check path to SSH keyfile +if [ -z "${sshKeyFile}" ]; then + consoleError 2 "$varsFile: 'sshKeyFile' is not specified." +elif [ ! -f "${sshKeyFile}" ]; then + consoleError 2 "$varsFile: 'sshKeyFile' does not exist." +fi +export BORG_RSH="ssh -i ${sshKeyFile}" + +# check borg repo connect string +if [ -z "${borgRepo}" ]; then + consoleError 2 "$varsFile: 'borgRepo' is not specified." +fi +export BORG_REPO="${borgRepo}" + +# check borg repo password +if [ -n "${borgRepoPassword}" ]; then + export BORG_PASSPHRASE="${borgRepoPassword}" +elif [ "${borgRepoPassword}" = '' ]; then + export BORG_PASSPHRASE="" +else + consoleError 2 "$varsFile: 'borgRepoPassword' must be specified or must be '' if no password has been set (VERY INSECURE!)." +fi + +# export borg remote path, if specified +if [ -n "${borgRemote}" ]; then export BORG_REMOTE_PATH="${borgRemote}"; fi +