From b2274a686caf2c98cb4c35d0c5a14a45a3fb204e Mon Sep 17 00:00:00 2001 From: th33xitus Date: Thu, 26 May 2022 10:13:59 +0200 Subject: [PATCH] refactor: backup full config folder before install of mainsail/fluidd/klipperscreen we don't know if some files need to be modified. so to be safe, backup all of them no matter what. this will also not create redundant intermediate backups. Signed-off-by: Dominik Willner th33xitus@gmail.com --- scripts/fluidd.sh | 6 +++--- scripts/klipperscreen.sh | 3 +++ scripts/mainsail.sh | 6 +++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/scripts/fluidd.sh b/scripts/fluidd.sh index d363f15..ba3335d 100644 --- a/scripts/fluidd.sh +++ b/scripts/fluidd.sh @@ -33,6 +33,9 @@ function install_fluidd() { process_disruptive_services status_msg "Initializing Fluidd installation ..." + ### first, we create a backup of the full klipper_config dir - safety first! + backup_klipper_config_dir + ### check for other enabled web interfaces unset SET_LISTEN_PORT detect_enabled_sites @@ -128,9 +131,6 @@ function download_fluidd_macros() { configs=$(find "${KLIPPER_CONFIG}" -type f -name "printer.cfg" | sort) if [[ -n ${configs} ]]; then - ### create a backup of the config folder - backup_klipper_config_dir - for config in ${configs}; do path=$(echo "${config}" | rev | cut -d"/" -f2- | rev) if [[ ! -f "${path}/fluidd.cfg" ]]; then diff --git a/scripts/klipperscreen.sh b/scripts/klipperscreen.sh index 5809389..831f916 100644 --- a/scripts/klipperscreen.sh +++ b/scripts/klipperscreen.sh @@ -29,6 +29,9 @@ function install_klipperscreen() { print_error "${error}" && return fi + ### first, we create a backup of the full klipper_config dir - safety first! + backup_klipper_config_dir + ### install KlipperScreen klipperscreen_setup diff --git a/scripts/mainsail.sh b/scripts/mainsail.sh index 7a6e035..b08eb0d 100644 --- a/scripts/mainsail.sh +++ b/scripts/mainsail.sh @@ -33,6 +33,9 @@ function install_mainsail() { process_disruptive_services status_msg "Initializing Mainsail installation ..." + ### first, we create a backup of the full klipper_config dir - safety first! + backup_klipper_config_dir + ### check for other enabled web interfaces unset SET_LISTEN_PORT detect_enabled_sites @@ -128,9 +131,6 @@ function download_mainsail_macros() { configs=$(find "${KLIPPER_CONFIG}" -type f -name "printer.cfg" | sort) if [[ -n ${configs} ]]; then - ### create a backup of the config folder - backup_klipper_config_dir - for config in ${configs}; do path=$(echo "${config}" | rev | cut -d"/" -f2- | rev) if [[ ! -f "${path}/mainsail.cfg" ]]; then