From 9e9081e4ccbf45fa8df067570e4fca985bdbbec3 Mon Sep 17 00:00:00 2001 From: Cyril Date: Sun, 31 Mar 2024 23:35:16 +0200 Subject: [PATCH] Update --- scripts/menu/KE/info_menu_KE.sh | 9 ++++ scripts/menu/KE/install_menu_KE.sh | 11 +++++ scripts/menu/KE/remove_menu_KE.sh | 7 +++ scripts/menu/info_menu.sh | 9 ++++ scripts/menu/install_menu.sh | 11 +++++ scripts/menu/remove_menu.sh | 7 +++ scripts/octoapp_companion.sh | 1 + scripts/simplyprint.sh | 71 ++++++++++++++++++++++++++++++ 8 files changed, 126 insertions(+) create mode 100755 scripts/simplyprint.sh diff --git a/scripts/menu/KE/info_menu_KE.sh b/scripts/menu/KE/info_menu_KE.sh index c597908..627b4c5 100755 --- a/scripts/menu/KE/info_menu_KE.sh +++ b/scripts/menu/KE/info_menu_KE.sh @@ -20,6 +20,14 @@ function check_file_ke() { fi } +function check_simplyprint_ke() { + if grep -q "\[simplyprint\]" "$MOONRAKER_CFG"; then + echo -e "${green}✓" + else + echo -e "${red}✗" + fi +} + function info_menu_ui_ke() { top_line title '[ INFORMATIONS MENU ]' "${yellow}" @@ -49,6 +57,7 @@ function info_menu_ui_ke() { info_line "$(check_folder_ke "$GUPPYFLO_FOLDER")" 'GuppyFLO' info_line "$(check_folder_ke "$MOBILERAKER_COMPANION_FOLDER")" 'Mobileraker Companion' info_line "$(check_folder_ke "$OCTOAPP_COMPANION_FOLDER")" 'OctoApp Companion' + info_line "$(check_simplyprint_ke)" 'SimplyPrint' hr subtitle '•CUSTOMIZATION:' info_line "$(check_file_ke "$CREALITY_WEB_FILE")" 'Creality Web Interface' diff --git a/scripts/menu/KE/install_menu_KE.sh b/scripts/menu/KE/install_menu_KE.sh index 2a2e2ec..e3bbc8a 100755 --- a/scripts/menu/KE/install_menu_KE.sh +++ b/scripts/menu/KE/install_menu_KE.sh @@ -31,6 +31,7 @@ function install_menu_ui_ke() { menu_option '13' 'Install' 'GuppyFLO' menu_option '14' 'Install' 'Mobileraker Companion' menu_option '15' 'Install' 'OctoApp Companion' + menu_option '16' 'Install' 'SimplyPrint' hr inner_line hr @@ -174,6 +175,16 @@ function install_menu_ke() { else run "install_octoapp_companion" "install_menu_ui_ke" fi;; + 16) + if grep -q "\[simplyprint\]" "$MOONRAKER_CFG"; then + error_msg "SimplyPrint is already installed!" + elif [ ! -d "$MOONRAKER_FOLDER" ]; then + error_msg "Moonraker and Nginx are needed, please install them first!" + elif [ ! -d "$FLUIDD_FOLDER" ] && [ ! -d "$MAINSAIL_FOLDER" ]; then + error_msg "Fluidd or Mainsail is needed, please install it first!" + else + run "install_simplyprint" "install_menu_ui_ke" + fi;; B|b) clear; main_menu; break;; Q|q) diff --git a/scripts/menu/KE/remove_menu_KE.sh b/scripts/menu/KE/remove_menu_KE.sh index 0a52f31..74ee2e4 100755 --- a/scripts/menu/KE/remove_menu_KE.sh +++ b/scripts/menu/KE/remove_menu_KE.sh @@ -31,6 +31,7 @@ function remove_menu_ui_ke() { menu_option '13' 'Remove' 'GuppyFLO' menu_option '14' 'Remove' 'Mobileraker Companion' menu_option '15' 'Remove' 'OctoApp Companion' + menu_option '16' 'Remove' 'SimplyPrint' hr inner_line hr @@ -160,6 +161,12 @@ function remove_menu_ke() { else run "remove_octoapp_companion" "remove_menu_ui_ke" fi;; + 16) + if ! grep -q "\[simplyprint\]" "$MOONRAKER_CFG"; then + error_msg "SimplyPrint is not installed!" + else + run "remove_simplyprint" "remove_menu_ui" + fi;; B|b) clear; main_menu; break;; Q|q) diff --git a/scripts/menu/info_menu.sh b/scripts/menu/info_menu.sh index 351543d..d6e9a23 100755 --- a/scripts/menu/info_menu.sh +++ b/scripts/menu/info_menu.sh @@ -20,6 +20,14 @@ function check_file() { fi } +function check_simplyprint() { + if grep -q "\[simplyprint\]" "$MOONRAKER_CFG"; then + echo -e "${green}✓" + else + echo -e "${red}✗" + fi +} + function info_menu_ui() { top_line title '[ INFORMATIONS MENU ]' "${yellow}" @@ -57,6 +65,7 @@ function info_menu_ui() { info_line "$(check_folder "$GUPPYFLO_FOLDER")" 'GuppyFLO' info_line "$(check_folder "$MOBILERAKER_COMPANION_FOLDER")" 'Mobileraker Companion' info_line "$(check_folder "$OCTOAPP_COMPANION_FOLDER")" 'OctoApp Companion' + info_line "$(check_simplyprint)" 'SimplyPrint' hr subtitle '•CUSTOMIZATION:' info_line "$(check_file "$BOOT_DISPLAY_FILE")" 'Custom Boot Display' diff --git a/scripts/menu/install_menu.sh b/scripts/menu/install_menu.sh index ff77f4a..e2fa220 100755 --- a/scripts/menu/install_menu.sh +++ b/scripts/menu/install_menu.sh @@ -39,6 +39,7 @@ function install_menu_ui() { menu_option '21' 'Install' 'GuppyFLO' menu_option '22' 'Install' 'Mobileraker Companion' menu_option '23' 'Install' 'OctoApp Companion' + menu_option '24' 'Install' 'SimplyPrint' hr inner_line hr @@ -240,6 +241,16 @@ function install_menu() { else run "install_octoapp_companion" "install_menu_ui" fi;; + 24) + if grep -q "\[simplyprint\]" "$MOONRAKER_CFG"; then + error_msg "SimplyPrint is already installed!" + elif [ ! -d "$MOONRAKER_FOLDER" ]; then + error_msg "Moonraker and Nginx are needed, please install them first!" + elif [ ! -d "$FLUIDD_FOLDER" ] && [ ! -d "$MAINSAIL_FOLDER" ]; then + error_msg "Fluidd or Mainsail is needed, please install it first!" + else + run "install_simplyprint" "install_menu_ui" + fi;; B|b) clear; main_menu; break;; Q|q) diff --git a/scripts/menu/remove_menu.sh b/scripts/menu/remove_menu.sh index 3d0c226..71c2206 100755 --- a/scripts/menu/remove_menu.sh +++ b/scripts/menu/remove_menu.sh @@ -39,6 +39,7 @@ function remove_menu_ui() { menu_option '21' 'Remove' 'GuppyFLO' menu_option '22' 'Remove' 'Mobileraker Companion' menu_option '23' 'Remove' 'OctoApp Companion' + menu_option '24' 'Remove' 'SimplyPrint' hr inner_line hr @@ -222,6 +223,12 @@ function remove_menu() { else run "remove_octoapp_companion" "remove_menu_ui" fi;; + 24) + if ! grep -q "\[simplyprint\]" "$MOONRAKER_CFG"; then + error_msg "SimplyPrint is not installed!" + else + run "remove_simplyprint" "remove_menu_ui" + fi;; B|b) clear; main_menu; break;; Q|q) diff --git a/scripts/octoapp_companion.sh b/scripts/octoapp_companion.sh index c19a729..3bcccbe 100755 --- a/scripts/octoapp_companion.sh +++ b/scripts/octoapp_companion.sh @@ -53,6 +53,7 @@ function remove_octoapp_companion(){ echo -e "Info: Running OctoApp Companion uninstaller..." cd "$OCTOAPP_COMPANION_FOLDER" sh ./uninstall.sh + rm -f /root/update-OctoApp.sh ok_msg "OctoApp Companion has been removed successfully!" return;; N|n) diff --git a/scripts/simplyprint.sh b/scripts/simplyprint.sh new file mode 100755 index 0000000..2aaaad5 --- /dev/null +++ b/scripts/simplyprint.sh @@ -0,0 +1,71 @@ +#!/bin/sh + +set -e + +function simplyprint_message(){ + top_line + title 'SimplyPrint' "${yellow}" + inner_line + hr + echo -e " │ ${cyan}SimplyPrint allows you to start those prints that you just ${white}│" + echo -e " │ ${cyan}need to be done sooner rather than later. You can send print ${white}│" + echo -e " │ ${cyan}jobs to your printer from anywhere in the world. ${white}│" + hr + bottom_line +} + +function install_simplyprint(){ + simplyprint_message + local yn + while true; do + install_msg "SimplyPrint" yn + case "${yn}" in + Y|y) + echo -e "${white}" + if ! grep -q "\[simplyprint\]" "$MOONRAKER_CFG"; then + echo -e "Info: Enabling SimplyPrint configurations in moonraker.conf file..." + sed -i -e '/\[simplyprint\]/!{ $s/$/\n\n[simplyprint]/;}' "$MOONRAKER_CFG" + else + echo -e "Info: SimplyPrint configurations are already enabled in moonraker.conf file..." + fi + echo -e "Info: Restarting Moonraker service..." + stop_moonraker + start_moonraker + ok_msg "SimplyPrint has been installed successfully!" + return;; + N|n) + error_msg "Installation canceled!" + return;; + *) + error_msg "Please select a correct choice!";; + esac + done +} + +function remove_simplyprint(){ + simplyprint_message + local yn + while true; do + remove_msg "SimplyPrint" yn + case "${yn}" in + Y|y) + echo -e "${white}" + if grep -q "\[simplyprint\]" "$MOONRAKER_CFG"; then + echo "Info: Removing SimplyPrint configurations in moonraker.conf file..." + sed -i -e '/\[simplyprint\]/{x;d;};x' "$MOONRAKER_CFG" + else + echo "Info: SimplyPrint configurations are already removed in moonraker.conf file." + fi + echo -e "Info: Restarting Moonraker service..." + stop_moonraker + start_moonraker + ok_msg "SimplyPrint has been removed successfully!" + return;; + N|n) + error_msg "Deletion canceled!" + return;; + *) + error_msg "Please select a correct choice!";; + esac + done +} \ No newline at end of file