From 40f861804b268a92909d5b38149985e788407c70 Mon Sep 17 00:00:00 2001 From: Enrico Ludwig Date: Mon, 13 May 2024 19:29:46 +0200 Subject: [PATCH] Fixed issues with leading slash and missing python3-venv package --- borgmatic_setup.sh | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/borgmatic_setup.sh b/borgmatic_setup.sh index c2566b5..6da86e1 100755 --- a/borgmatic_setup.sh +++ b/borgmatic_setup.sh @@ -24,6 +24,12 @@ # Planned Features: # - Add support for more distributions +# - Add support for databases +# - Pre-Backup commands +# - Post-Backup commands + +# Bugs: +# - On Ubuntu Server: always asking for password despite ssh key was successfully copied # SETTINGS - Make sure to adjust these settings to your needs DEBUG=0 # Set to 1 to enable debug mode @@ -559,9 +565,9 @@ if [ ! -f /etc/os-release ]; then exit 1 fi -wrn "This script will install \e[1mborgbackup\e[0m, \e[1mpipx\e[0m" -wrn "and \e[1msshpass\e[0m from the official repositories as well" -wrn "as \e[1mborgmatic\e[0m from the official PyPI repository." +wrn "This script will install \e[1mborgbackup\e[0m, \e[1mpipx\e[0m, python3-venv" +wrn "and \e[1msshpass\e[0m from the official repositories and \e[1mborgmatic\e[0m" +wrn "from the official PyPI repository." inf "The following settings will be used for the backup setup:" inf "Backup repository: $BACKUP_REPO" @@ -602,6 +608,13 @@ else fi fi +if ! inf_follow "Checking if python3-venv is installed..." "\e[1;32mYes\e[0m" "\e[1;31mNo\e[0m" apt_is_installed python3-venv; then + if ! inf_follow "Installing python3-venv..." "\e[1;32mOK\e[0m" "\e[1;31mFAILED\e[0m" apt_install python3-venv; then + err "Installation of python3-venv failed!" + exit 1 + fi +fi + if [ -z $NO_UPGRADE ]; then if [ -z $AUTO ] && infp "Do you also want to upgrade all installed packages? [y/N]"; then if ! inf_follow "Upgrading packages..." "\e[1;32mOK\e[0m" "\e[1;31mFAILED\e[0m" apt_upgrade; then @@ -764,6 +777,13 @@ if ! inf_follow "Checking for borgmatic configuration directory..." "\e[1;32mYes fi fi +if [ "${BACKUP_REPO:0:1}" == "/" ]; then + wrn "Your backup repository path starts with a '/', which is not recommended." + wrn "It will be removed automatically, but please make sure you have set the correct" + wrn "path. Leading slashes will cause the config validation to fail." + BACKUP_REPO=${BACKUP_REPO:1} +fi + cat > $BORGMATIC_CONFIG_FILE <