Fixed issues with leading slash and missing python3-venv package

This commit is contained in:
Enrico Ludwig 2024-05-13 19:29:46 +02:00
parent 14122a7fd7
commit 40f861804b

View File

@ -24,6 +24,12 @@
# Planned Features: # Planned Features:
# - Add support for more distributions # - 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 # SETTINGS - Make sure to adjust these settings to your needs
DEBUG=0 # Set to 1 to enable debug mode DEBUG=0 # Set to 1 to enable debug mode
@ -559,9 +565,9 @@ if [ ! -f /etc/os-release ]; then
exit 1 exit 1
fi fi
wrn "This script will install \e[1mborgbackup\e[0m, \e[1mpipx\e[0m" 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 as well" wrn "and \e[1msshpass\e[0m from the official repositories and \e[1mborgmatic\e[0m"
wrn "as \e[1mborgmatic\e[0m from the official PyPI repository." wrn "from the official PyPI repository."
inf "The following settings will be used for the backup setup:" inf "The following settings will be used for the backup setup:"
inf "Backup repository: $BACKUP_REPO" inf "Backup repository: $BACKUP_REPO"
@ -602,6 +608,13 @@ else
fi fi
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 $NO_UPGRADE ]; then
if [ -z $AUTO ] && infp "Do you also want to upgrade all installed packages? [y/N]"; 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 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
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 <<EOF cat > $BORGMATIC_CONFIG_FILE <<EOF
ssh_command: ssh -i $SSH_KEY_FILE -p $SSH_PORT ssh_command: ssh -i $SSH_KEY_FILE -p $SSH_PORT