script: separate moonraker removal with whiptail
This commit is contained in:
@@ -1,36 +1,13 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
remove_klipper(){
|
remove_klipper(){
|
||||||
|
#TODO The logic to Ask if you want to remove moonraker should be outside of remove_klipper
|
||||||
shopt -s extglob # enable extended globbing
|
shopt -s extglob # enable extended globbing
|
||||||
### ask the user if he wants to uninstall moonraker too.
|
### ask the user if he wants to uninstall moonraker too.
|
||||||
###? currently usefull if the user wants to switch from single-instance to multi-instance
|
###? currently usefull if the user wants to switch from single-instance to multi-instance
|
||||||
FILE="$SYSTEMD_DIR/moonraker?(-*([0-9])).service"
|
FILE="$SYSTEMD_DIR/moonraker?(-*([0-9])).service"
|
||||||
if ls $FILE 2>/dev/null 1>&2; then
|
if ls $FILE 2>/dev/null 1>&2; then
|
||||||
while true; do
|
remove_moonraker_yesno
|
||||||
unset REM_MR
|
|
||||||
top_border
|
|
||||||
echo -e "| Do you want to remove Moonraker afterwards? |"
|
|
||||||
echo -e "| |"
|
|
||||||
echo -e "| This is useful in case you want to switch from a |"
|
|
||||||
echo -e "| single-instance to a multi-instance installation, |"
|
|
||||||
echo -e "| which makes a re-installation of Moonraker necessary. |"
|
|
||||||
echo -e "| |"
|
|
||||||
echo -e "| If for any other reason you only want to uninstall |"
|
|
||||||
echo -e "| Klipper, please select 'No' and continue. |"
|
|
||||||
bottom_border
|
|
||||||
read -p "${cyan}###### Remove Moonraker afterwards? (y/N):${default} " yn
|
|
||||||
case "$yn" in
|
|
||||||
Y|y|Yes|yes)
|
|
||||||
echo -e "###### > Yes"
|
|
||||||
REM_MR="true"
|
|
||||||
break;;
|
|
||||||
N|n|No|no|"")
|
|
||||||
echo -e "###### > No"
|
|
||||||
REM_MR="false"
|
|
||||||
break;;
|
|
||||||
*)
|
|
||||||
print_unkown_cmd
|
|
||||||
print_msg && clear_msg;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
### remove "legacy" klipper init.d service
|
### remove "legacy" klipper init.d service
|
||||||
|
|||||||
17
scripts/ui/remove_moonraker_yesno.sh
Executable file
17
scripts/ui/remove_moonraker_yesno.sh
Executable file
@@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
remove_moonraker_yesno(){
|
||||||
|
whiptail --title "Remove" \
|
||||||
|
--yesno \
|
||||||
|
"Do you want to remove Moonraker afterwards?
|
||||||
|
|
||||||
|
This is useful in case you want to switch from a single-instance to a multi-instance installation, which makes a re-installation of Moonraker necessary.
|
||||||
|
|
||||||
|
If for any other reason you only want to uninstall Klipper, please select 'No' and continue." \
|
||||||
|
"$KIAUH_WHIPTAIL_NORMAL_HEIGHT" "$KIAUH_WHIPTAIL_NORMAL_WIDTH"
|
||||||
|
|
||||||
|
local out=$?
|
||||||
|
if [ $out -eq 0 ]; then
|
||||||
|
REM_MR="true"
|
||||||
|
else
|
||||||
|
REM_MR="false"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user