script: whiptail remove menu
This commit is contained in:
36
scripts/ui/remove_interface_menu.sh
Executable file
36
scripts/ui/remove_interface_menu.sh
Executable file
@@ -0,0 +1,36 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Brief description of your script
|
||||||
|
|
||||||
|
remove_interface_menu(){
|
||||||
|
|
||||||
|
local menu_options=(
|
||||||
|
"1" "Mainsail - lightweight & responsive web interface for Klipper"
|
||||||
|
"2" "Fluidd - a free and open-source Klipper web interface for managing your 3d printer"
|
||||||
|
"3" "KlipperScreen - a touchscreen GUI that interfaces with Klipper via Moonraker"
|
||||||
|
"4" "Duet Web Control - a fully-responsive HTML5-based web interface for RepRapFirmware"
|
||||||
|
"5" "OctoPrint - a snappy web interface for controlling consumer 3D printers."
|
||||||
|
)
|
||||||
|
local menu_str="Select an interface to install, you can install multiple interfaces."
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
local menu
|
||||||
|
menu=$(whiptail --title "Install Interface" --cancel-button "Back" --notags --menu "$menu_str\n\nPerform Action:" \
|
||||||
|
"$KIAUH_WHIPTAIL_NORMAL_HEIGHT" "$KIAUH_WHIPTAIL_NORMAL_WIDTH" 8 "${menu_options[@]}" 3>&1 1>&2 2>&3)
|
||||||
|
local out=$?
|
||||||
|
if [ $out -eq 1 ]; then
|
||||||
|
break
|
||||||
|
elif [ $out -eq 0 ]; then
|
||||||
|
case "$menu" in
|
||||||
|
1) do_action "install_webui mainsail";;
|
||||||
|
2) do_action "install_webui fluidd";;
|
||||||
|
3) do_action "install_klipperscreen";;
|
||||||
|
4) do_action "dwc_setup_dialog";;
|
||||||
|
5) do_action "octoprint_setup_dialog";;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
# Unexpected event, no clue what happened
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
remove_ui(){
|
remove_ui(){
|
||||||
top_border
|
top_border
|
||||||
echo -e "| ${red}~~~~~~~~~~~~~~ [ Remove Menu ] ~~~~~~~~~~~~~~${default} | "
|
echo -e "| ${red}~~~~~~~~~~~~~~ [ Remove Menu ] ~~~~~~~~~~~~~~${default} | "
|
||||||
@@ -22,37 +23,37 @@ remove_ui(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
remove_menu(){
|
remove_menu(){
|
||||||
do_action "" "remove_ui"
|
#TODO Currently it's a "dumb" remove page, looking for a "smart" one
|
||||||
|
local menu_options=(
|
||||||
|
"1" "Klipper"
|
||||||
|
"2" "Klipper API(Moonraker)"
|
||||||
|
"3" "Interfaces"
|
||||||
|
"4" "Other"
|
||||||
|
)
|
||||||
|
local menu_str="Directories which remain untouched:
|
||||||
|
|
||||||
|
Your printer configuration directory
|
||||||
|
~/kiauh-backups
|
||||||
|
|
||||||
|
You need remove them manually if you wish so."
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
read -p "${cyan}Perform action:${default} " action; echo
|
local menu
|
||||||
case "$action" in
|
menu=$(whiptail --title "Remove Menu" --cancel-button "Back" --notags --menu "$menu_str\n\nPerform Action:" \
|
||||||
1)
|
"$KIAUH_WHIPTAIL_NORMAL_HEIGHT" "$KIAUH_WHIPTAIL_NORMAL_WIDTH" 8 "${menu_options[@]}" 3>&1 1>&2 2>&3)
|
||||||
do_action "remove_klipper" "remove_ui";;
|
local out=$?
|
||||||
2)
|
if [ $out -eq 1 ]; then
|
||||||
do_action "remove_moonraker" "remove_ui";;
|
break
|
||||||
3)
|
elif [ $out -eq 0 ]; then
|
||||||
do_action "remove_mainsail" "remove_ui";;
|
case "$menu" in
|
||||||
4)
|
1) do_action "remove_klipper";;
|
||||||
do_action "remove_fluidd" "remove_ui";;
|
2) do_action "remove_moonraker";;
|
||||||
5)
|
3) remove_interface_menu;;
|
||||||
do_action "remove_klipperscreen" "remove_ui";;
|
4) remove_other_menu;;
|
||||||
6)
|
esac
|
||||||
do_action "remove_dwc2" "remove_ui";;
|
else
|
||||||
7)
|
# Unexpected event, no clue what happened
|
||||||
do_action "remove_octoprint" "remove_ui";;
|
exit 1
|
||||||
8)
|
fi
|
||||||
do_action "remove_prettygcode" "remove_ui";;
|
|
||||||
9)
|
|
||||||
do_action "remove_MoonrakerTelegramBot" "remove_ui";;
|
|
||||||
10)
|
|
||||||
do_action "remove_mjpg-streamer" "remove_ui";;
|
|
||||||
11)
|
|
||||||
do_action "remove_nginx" "remove_ui";;
|
|
||||||
B|b)
|
|
||||||
clear; main_menu; break;;
|
|
||||||
*)
|
|
||||||
deny_action "remove_ui";;
|
|
||||||
esac
|
|
||||||
done
|
done
|
||||||
remove_menu
|
|
||||||
}
|
}
|
||||||
|
|||||||
34
scripts/ui/remove_other_menu.sh
Executable file
34
scripts/ui/remove_other_menu.sh
Executable file
@@ -0,0 +1,34 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Brief description of your script
|
||||||
|
|
||||||
|
remove_other_menu() {
|
||||||
|
|
||||||
|
local menu_options=(
|
||||||
|
#TODO WIP
|
||||||
|
"1" "PrettyGCode - "
|
||||||
|
"2" "Klipper Telegram Bot - "
|
||||||
|
"3" "Webcam MJPG-Streamer - Use MJPG-Streamer with webcam"
|
||||||
|
"4" "Nginx"
|
||||||
|
)
|
||||||
|
local menu_str="Select an option to install."
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
local menu
|
||||||
|
menu=$(whiptail --title "Remove Other" --cancel-button "Back" --notags --menu "$menu_str\n\nPerform Action:" \
|
||||||
|
"$KIAUH_WHIPTAIL_NORMAL_HEIGHT" "$KIAUH_WHIPTAIL_NORMAL_WIDTH" 8 "${menu_options[@]}" 3>&1 1>&2 2>&3)
|
||||||
|
local out=$?
|
||||||
|
if [ $out -eq 1 ]; then
|
||||||
|
break
|
||||||
|
elif [ $out -eq 0 ]; then
|
||||||
|
case "$menu" in
|
||||||
|
1) do_action "remove_pgc_for_klipper" ;;
|
||||||
|
2) do_action "remove_MoonrakerTelegramBot" ;;
|
||||||
|
3) do_action "remove_mjpg-streamer" ;;
|
||||||
|
4) do_action "remove_nginx" ;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
# Unexpected event, no clue what happened
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user