diff --git a/scripts/menu/10SE/install_menu_10SE.sh b/scripts/menu/10SE/install_menu_10SE.sh index 249a718..2b88ffb 100755 --- a/scripts/menu/10SE/install_menu_10SE.sh +++ b/scripts/menu/10SE/install_menu_10SE.sh @@ -33,6 +33,7 @@ function install_menu_ui_10se() { menu_option '15' 'Install' 'Mobileraker Companion' menu_option '16' 'Install' 'OctoApp Companion' menu_option '17' 'Install' 'SimplyPrint' + menu_option '18' 'Install' 'Polar Cloud' hr inner_line hr @@ -198,6 +199,18 @@ function install_menu_10se() { else run "install_simplyprint" "install_menu_ui_10se" fi;; + 18) + if [ -d "$POLARCLOUD_FOLDER" ]; then + error_msg "Polar Cloud 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 one of them first!" + elif [ ! -f "$ENTWARE_FILE" ]; then + error_msg "Entware is needed, please install it first!" + else + run "install_polarcloud" "install_menu_ui_10se" + fi;; B|b) clear; main_menu; break;; Q|q) diff --git a/scripts/menu/10SE/remove_menu_10SE.sh b/scripts/menu/10SE/remove_menu_10SE.sh index fdbb7a7..bf71616 100755 --- a/scripts/menu/10SE/remove_menu_10SE.sh +++ b/scripts/menu/10SE/remove_menu_10SE.sh @@ -33,6 +33,7 @@ function remove_menu_ui_10se() { menu_option '15' 'Remove' 'Mobileraker Companion' menu_option '16' 'Remove' 'OctoApp Companion' menu_option '17' 'Remove' 'SimplyPrint' + menu_option '18' 'Remove' 'Polar Cloud' hr inner_line hr @@ -178,6 +179,12 @@ function remove_menu_10se() { else run "remove_simplyprint" "remove_menu_ui_10se" fi;; + 18) + if [ ! -d "$POLARCLOUD_FOLDER" ]; then + error_msg "Polar Cloud is not installed!" + else + run "remove_polarcloud" "remove_menu_ui_10se" + fi;; B|b) clear; main_menu; break;; Q|q) diff --git a/scripts/menu/3KE/install_menu_3KE.sh b/scripts/menu/3KE/install_menu_3KE.sh index 61d0fa4..a64746b 100755 --- a/scripts/menu/3KE/install_menu_3KE.sh +++ b/scripts/menu/3KE/install_menu_3KE.sh @@ -35,6 +35,7 @@ function install_menu_ui_3ke() { menu_option '17' 'Install' 'Mobileraker Companion' menu_option '18' 'Install' 'OctoApp Companion' menu_option '19' 'Install' 'SimplyPrint' + menu_option '20' 'Install' 'Polar Cloud' hr inner_line hr @@ -212,6 +213,18 @@ function install_menu_3ke() { else run "install_simplyprint" "install_menu_ui_3ke" fi;; + 20) + if [ -d "$POLARCLOUD_FOLDER" ]; then + error_msg "Polar Cloud 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 one of them first!" + elif [ ! -f "$ENTWARE_FILE" ]; then + error_msg "Entware is needed, please install it first!" + else + run "install_polarcloud" "install_menu_ui_3ke" + fi;; B|b) clear; main_menu; break;; Q|q) diff --git a/scripts/menu/3KE/remove_menu_3KE.sh b/scripts/menu/3KE/remove_menu_3KE.sh index e21cc87..3761d42 100755 --- a/scripts/menu/3KE/remove_menu_3KE.sh +++ b/scripts/menu/3KE/remove_menu_3KE.sh @@ -35,6 +35,7 @@ function remove_menu_ui_3ke() { menu_option '17' 'Remove' 'Mobileraker Companion' menu_option '18' 'Remove' 'OctoApp Companion' menu_option '19' 'Remove' 'SimplyPrint' + menu_option '20' 'Remove' 'Polar Cloud' hr inner_line hr @@ -192,6 +193,12 @@ function remove_menu_3ke() { else run "remove_simplyprint" "remove_menu_ui_3ke" fi;; + 20) + if [ ! -d "$POLARCLOUD_FOLDER" ]; then + error_msg "Polar Cloud is not installed!" + else + run "remove_polarcloud" "remove_menu_ui_3ke" + fi;; B|b) clear; main_menu; break;; Q|q) diff --git a/scripts/menu/3V3/install_menu_3V3.sh b/scripts/menu/3V3/install_menu_3V3.sh index c5b6d21..e2f7ff5 100755 --- a/scripts/menu/3V3/install_menu_3V3.sh +++ b/scripts/menu/3V3/install_menu_3V3.sh @@ -37,6 +37,7 @@ function install_menu_ui_3v3() { menu_option '19' 'Install' 'Mobileraker Companion' menu_option '20' 'Install' 'OctoApp Companion' menu_option '21' 'Install' 'SimplyPrint' + menu_option '22' 'Install' 'Polar Cloud' hr inner_line hr @@ -230,6 +231,18 @@ function install_menu_3v3() { else run "install_simplyprint" "install_menu_ui_3v3" fi;; + 22) + if [ -d "$POLARCLOUD_FOLDER" ]; then + error_msg "Polar Cloud is already installed!" + elif [ ! -d "$MOONRAKER_FOLDER" ]; then + error_msg "Updated Moonraker is needed, please install it first!" + elif [ ! -d "$FLUIDD_FOLDER" ] && [ ! -d "$MAINSAIL_FOLDER" ]; then + error_msg "Updated Fluidd or Mainsail is needed, please install one of them first!" + elif [ ! -f "$ENTWARE_FILE" ]; then + error_msg "Entware is needed, please install it first!" + else + run "install_polarcloud" "install_menu_ui_3v3" + fi;; B|b) clear; main_menu; break;; Q|q) diff --git a/scripts/menu/3V3/remove_menu_3V3.sh b/scripts/menu/3V3/remove_menu_3V3.sh index fbcace1..bc96a99 100755 --- a/scripts/menu/3V3/remove_menu_3V3.sh +++ b/scripts/menu/3V3/remove_menu_3V3.sh @@ -37,6 +37,7 @@ function remove_menu_ui_3v3() { menu_option '19' 'Remove' 'Mobileraker Companion' menu_option '20' 'Remove' 'OctoApp Companion' menu_option '21' 'Remove' 'SimplyPrint' + menu_option '22' 'Remove' 'Polar Cloud' hr inner_line hr @@ -204,6 +205,12 @@ function remove_menu_3v3() { else run "remove_simplyprint" "remove_menu_ui_3v3" fi;; + 22) + if [ ! -d "$POLARCLOUD_FOLDER" ]; then + error_msg "Polar Cloud is not installed!" + else + run "remove_polarcloud" "remove_menu_ui_3v3" + fi;; B|b) clear; main_menu; break;; Q|q) diff --git a/scripts/menu/E5M/install_menu_E5M.sh b/scripts/menu/E5M/install_menu_E5M.sh index 8eea1a7..771c095 100755 --- a/scripts/menu/E5M/install_menu_E5M.sh +++ b/scripts/menu/E5M/install_menu_E5M.sh @@ -40,6 +40,7 @@ function install_menu_ui_e5m() { menu_option '22' 'Install' 'Mobileraker Companion' menu_option '23' 'Install' 'OctoApp Companion' menu_option '24' 'Install' 'SimplyPrint' + menu_option '25' 'Install' 'Polar Cloud' hr inner_line hr @@ -249,6 +250,18 @@ function install_menu_e5m() { else run "install_simplyprint" "install_menu_ui_e5m" fi;; + 25) + if [ -d "$POLARCLOUD_FOLDER" ]; then + error_msg "Polar Cloud 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 one of them first!" + elif [ ! -f "$ENTWARE_FILE" ]; then + error_msg "Entware is needed, please install it first!" + else + run "install_polarcloud" "install_menu_ui_e5m" + fi;; B|b) clear; main_menu; break;; Q|q) diff --git a/scripts/menu/E5M/remove_menu_E5M.sh b/scripts/menu/E5M/remove_menu_E5M.sh index afc80b2..5771402 100755 --- a/scripts/menu/E5M/remove_menu_E5M.sh +++ b/scripts/menu/E5M/remove_menu_E5M.sh @@ -40,6 +40,7 @@ function remove_menu_ui_e5m() { menu_option '22' 'Remove' 'Mobileraker Companion' menu_option '23' 'Remove' 'OctoApp Companion' menu_option '24' 'Remove' 'SimplyPrint' + menu_option '25' 'Remove' 'Polar Cloud' hr inner_line hr @@ -233,6 +234,12 @@ function remove_menu_e5m() { else run "remove_simplyprint" "remove_menu_ui_e5m" fi;; + 25) + if [ ! -d "$POLARCLOUD_FOLDER" ]; then + error_msg "Polar Cloud is not installed!" + else + run "remove_polarcloud" "remove_menu_ui_e5m" + fi;; B|b) clear; main_menu; break;; Q|q) diff --git a/scripts/menu/K1/install_menu_K1.sh b/scripts/menu/K1/install_menu_K1.sh index 484ef35..815f162 100755 --- a/scripts/menu/K1/install_menu_K1.sh +++ b/scripts/menu/K1/install_menu_K1.sh @@ -40,6 +40,7 @@ function install_menu_ui_k1() { menu_option '22' 'Install' 'Mobileraker Companion' menu_option '23' 'Install' 'OctoApp Companion' menu_option '24' 'Install' 'SimplyPrint' + menu_option '25' 'Install' 'Polar Cloud' hr inner_line hr @@ -249,6 +250,18 @@ function install_menu_k1() { else run "install_simplyprint" "install_menu_ui_k1" fi;; + 25) + if [ -d "$POLARCLOUD_FOLDER" ]; then + error_msg "Polar Cloud 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 one of them first!" + elif [ ! -f "$ENTWARE_FILE" ]; then + error_msg "Entware is needed, please install it first!" + else + run "install_polarcloud" "install_menu_ui_k1" + fi;; B|b) clear; main_menu; break;; Q|q) diff --git a/scripts/menu/K1/remove_menu_K1.sh b/scripts/menu/K1/remove_menu_K1.sh index ebfbd43..2771e91 100755 --- a/scripts/menu/K1/remove_menu_K1.sh +++ b/scripts/menu/K1/remove_menu_K1.sh @@ -40,6 +40,7 @@ function remove_menu_ui_k1() { menu_option '22' 'Remove' 'Mobileraker Companion' menu_option '23' 'Remove' 'OctoApp Companion' menu_option '24' 'Remove' 'SimplyPrint' + menu_option '25' 'Remove' 'Polar Cloud' hr inner_line hr @@ -233,6 +234,12 @@ function remove_menu_k1() { else run "remove_simplyprint" "remove_menu_ui_k1" fi;; + 25) + if [ ! -d "$POLARCLOUD_FOLDER" ]; then + error_msg "Polar Cloud is not installed!" + else + run "remove_polarcloud" "remove_menu_ui_k1" + fi;; B|b) clear; main_menu; break;; Q|q) diff --git a/scripts/paths.sh b/scripts/paths.sh index ddb9468..6d5de32 100755 --- a/scripts/paths.sh +++ b/scripts/paths.sh @@ -164,6 +164,10 @@ function set_paths() { OCTOAPP_COMPANION_FOLDER="${USR_DATA}/octoapp" OCTOAPP_COMPANION_URL="https://github.com/crysxd/OctoApp-Plugin.git" + # Polar Cloud # + POLARCLOUD_FOLDER="${USR_DATA}/polar-cloud-klipper" + POLARCLOUD_URL="https://github.com/Polar3D/polar-cloud-klipper.git" + # Custom Boot Display # BOOT_DISPLAY_FOLDER="/etc/boot-display" BOOT_DISPLAY_FILE="${BOOT_DISPLAY_FOLDER}/part0/pic_100.jpg" diff --git a/scripts/polarcloud.sh b/scripts/polarcloud.sh new file mode 100644 index 0000000..f09a71b --- /dev/null +++ b/scripts/polarcloud.sh @@ -0,0 +1,68 @@ +#!/bin/sh + +set -e + +function polarcloud_message(){ + top_line + title 'Polar Cloud' "${yellow}" + inner_line + hr + echo -e " │ ${cyan}Polar Cloud provides remote access and monitoring for your ${white}│" + echo -e " │ ${cyan}3D printer. Connect to your printer from anywhere, manage ${white}│" + echo -e " │ ${cyan}print jobs, and access cloud-based slicing features. ${white}│" + hr + bottom_line +} + +function install_polarcloud(){ + polarcloud_message + local yn + while true; do + install_msg "Polar Cloud" yn + case "${yn}" in + Y|y) + echo -e "${white}" + if [ -d "$POLARCLOUD_FOLDER" ]; then + echo -e "Info: Polar Cloud is already installed. Download skipped." + else + echo -e "Info: Downloading Polar Cloud..." + git config --global http.sslVerify false + git clone "$POLARCLOUD_URL" "$POLARCLOUD_FOLDER" + fi + echo -e "Info: Running Polar Cloud installer..." + cd "$POLARCLOUD_FOLDER" + sh ./install.sh + echo + ok_msg "Polar Cloud has been installed successfully!" + return;; + N|n) + error_msg "Installation canceled!" + return;; + *) + error_msg "Please select a correct choice!";; + esac + done +} + +function remove_polarcloud(){ + polarcloud_message + local yn + while true; do + remove_msg "Polar Cloud" yn + case "${yn}" in + Y|y) + echo -e "${white}" + echo -e "Info: Running Polar Cloud uninstaller..." + cd "$POLARCLOUD_FOLDER" + sh ./uninstall.sh + echo + ok_msg "Polar Cloud has been removed successfully!" + return;; + N|n) + error_msg "Deletion canceled!" + return;; + *) + error_msg "Please select a correct choice!";; + esac + done +}