From 8cea54ea3825649047275b45cafaac6d6972558d Mon Sep 17 00:00:00 2001 From: Kenneth Jiang Date: Mon, 10 Jul 2023 00:11:20 +0100 Subject: [PATCH 1/4] Allow repairing incomplete installation using the install menu --- scripts/obico.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/scripts/obico.sh b/scripts/obico.sh index a831188..3194b11 100644 --- a/scripts/obico.sh +++ b/scripts/obico.sh @@ -85,6 +85,32 @@ function moonraker_obico_setup_dialog() { moonraker_obico_services=$(moonraker_obico_systemd) existing_moonraker_obico_count=$(echo "${moonraker_obico_services}" | wc -w ) local allowed_moonraker_obico_count=$(( moonraker_count - existing_moonraker_obico_count )) + + # Allow user to reinstall an incomplete installation. + if (( allowed_moonraker_obico_count == 0 && moonraker_count > 0 )); then + local yn + while true; do + echo "${yellow}Obico for Klipper is already installed.${white}" + echo "It is safe to run the install again to repair any issues." + echo "" + local question="Do you want to reinstall Obico for Klipper?" + read -p "${cyan}###### ${question} (Y/n):${white} " yn + case "${yn}" in + Y|y|Yes|yes|"") + select_msg "Yes" + break;; + N|n|No|no) + select_msg "No" + abort_msg "Exiting Obico for Klipper installation...\n" + return;; + *) + error_msg "Invalid Input!";; + esac + done + # The user responded yes, allow the install to run again. + allowed_moonraker_obico_count=1 + fi + if (( allowed_moonraker_obico_count > 0 )); then local new_moonraker_obico_count -- 2.39.5 From 0ff444f8a34c6e8534f7d014b8f71263361de99d Mon Sep 17 00:00:00 2001 From: Kenneth Jiang Date: Mon, 10 Jul 2023 00:25:32 +0100 Subject: [PATCH 2/4] Call 'install.sh -U' to make sure the system dependencies are up to date --- scripts/obico.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/obico.sh b/scripts/obico.sh index 3194b11..c3177e0 100644 --- a/scripts/obico.sh +++ b/scripts/obico.sh @@ -402,6 +402,8 @@ function update_moonraker_obico() { cd "${MOONRAKER_OBICO_DIR}" && git pull fi + "${MOONRAKER_OBICO_DIR}/install.sh" -U + ok_msg "Update complete!" do_action_service "restart" "moonraker-obico" } -- 2.39.5 From 3844fb4238017b0cba837cdc64ba3535723dd012 Mon Sep 17 00:00:00 2001 From: Kenneth Jiang Date: Mon, 10 Jul 2023 05:41:32 +0100 Subject: [PATCH 3/4] Dependencies are done in install.sh for the intial setup. Not needed in KIAUH --- scripts/obico.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/scripts/obico.sh b/scripts/obico.sh index c3177e0..66b507f 100644 --- a/scripts/obico.sh +++ b/scripts/obico.sh @@ -194,10 +194,6 @@ function moonraker_obico_setup_dialog() { (( new_moonraker_obico_count > 1 )) && status_msg "Installing ${new_moonraker_obico_count} Moonraker-obico instances ..." (( new_moonraker_obico_count == 1 )) && status_msg "Installing Moonraker-obico ..." - ### Step 4: Install dependencies - local dep=(git dfu-util virtualenv python3 python3-pip python3-venv ffmpeg) - dependency_check "${dep[@]}" - ### Step 5: Clone the moonraker-obico repo clone_moonraker_obico "${MOONRAKER_OBICO_REPO}" -- 2.39.5 From 30e36fc3bc851f6e4410818fb32ba4848fbce318 Mon Sep 17 00:00:00 2001 From: Kenneth Jiang Date: Mon, 10 Jul 2023 14:58:59 +0100 Subject: [PATCH 4/4] Bug: the intention of linking to server is mistaken as reinstalling/repairing the setup --- scripts/obico.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/obico.sh b/scripts/obico.sh index 66b507f..63e0586 100644 --- a/scripts/obico.sh +++ b/scripts/obico.sh @@ -87,7 +87,7 @@ function moonraker_obico_setup_dialog() { local allowed_moonraker_obico_count=$(( moonraker_count - existing_moonraker_obico_count )) # Allow user to reinstall an incomplete installation. - if (( allowed_moonraker_obico_count == 0 && moonraker_count > 0 )); then + if (( allowed_moonraker_obico_count == 0 && moonraker_count > 0 )) && [[ $(get_moonraker_obico_status) != "Not linked!" ]]; then local yn while true; do echo "${yellow}Obico for Klipper is already installed.${white}" -- 2.39.5