Allow repairing incomplete installation using the install menu

This commit is contained in:
Kenneth Jiang
2023-07-10 00:11:20 +01:00
parent 979c39dc02
commit 8cea54ea38

View File

@@ -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