From 7ee35044076bc9047e92c995bee50b3deca204c0 Mon Sep 17 00:00:00 2001 From: Cyril Date: Sat, 23 Mar 2024 14:53:32 +0100 Subject: [PATCH] Update --- scripts/guppyflo.sh | 91 ++++++++++++++++++++++++++++++ scripts/menu/KE/info_menu_KE.sh | 1 + scripts/menu/KE/install_menu_KE.sh | 7 +++ scripts/menu/KE/remove_menu_KE.sh | 7 +++ scripts/menu/info_menu.sh | 1 + scripts/menu/install_menu.sh | 7 +++ scripts/menu/remove_menu.sh | 7 +++ scripts/paths.sh | 4 ++ scripts/tools.sh | 3 + 9 files changed, 128 insertions(+) create mode 100755 scripts/guppyflo.sh diff --git a/scripts/guppyflo.sh b/scripts/guppyflo.sh new file mode 100755 index 0000000..f00b3f6 --- /dev/null +++ b/scripts/guppyflo.sh @@ -0,0 +1,91 @@ +#!/bin/sh + +set -e + +function guppyflo_message(){ + top_line + title 'GuppyFLO' "${yellow}" + inner_line + hr + echo -e " │ ${cyan}GuppyFLO is a self-hosted service that enables local/remote ${white}│" + echo -e " │ ${cyan}management of multiple Klipper printers using Moonraker. ${white}│" + hr + bottom_line +} + +function install_guppyflo(){ + guppyflo_message + local yn + while true; do + install_msg "GuppyFLO" yn + case "${yn}" in + Y|y) + echo -e "${white}" + if [ -f "$INITD_FOLDER"/S99guppyflo ]; then + echo -e "Info: Stopping GuppyFLO service..." + /etc/init.d/S99guppyflo stop &> /dev/null + fi + if [ -d "$GUPPYFLO_FOLDER" ]; then + rm -rf "$GUPPYFLO_FOLDER" + fi + if [ -f "$INITD_FOLDER"/S99guppyflo ]; then + rm -f "$INITD_FOLDER"/S99guppyflo + fi + if [ -f /lib/libeinfo.so.1 ]; then + rm -f /lib/libeinfo.so.1 + fi + if [ -f /lib/librc.so.1 ]; then + rm -f /lib/librc.so.1 + fi + echo -e "Info: Downloading GuppyFLO file..." + "$CURL" -L "$GUPPYFLO_URL" -o "$USR_DATA"/guppyflo.zip + echo -e "Info: Creating directory..." + mkdir -p "$GUPPYFLO_FOLDER" + echo -e "Info: Extracting files..." + unzip "$USR_DATA"/guppyflo.zip -d "$GUPPYFLO_FOLDER" + rm -f "$USR_DATA"/guppyflo.zip + echo -e "Info: Linking files..." + ln -sf "$GUPPYFLO_FOLDER"/services/S99guppyflo "$INITD_FOLDER"/S99guppyflo + ln -sf "$GUPPYFLO_FOLDER"/services/respawn/libeinfo.so.1 /lib/libeinfo.so.1 + ln -sf "$GUPPYFLO_FOLDER"/services/respawn/librc.so.1 /lib/librc.so.1 + echo -e "Info: Starting GuppyFLO service..." + /etc/init.d/S99guppyflo start &> /dev/null + ok_msg "GuppyFLO has been installed successfully!" + echo -e " You can now connect to GuppyFLO Web Interface with ${yellow}http://$(check_ipaddress):9873${white}" + return;; + N|n) + error_msg "Installation canceled!" + return;; + *) + error_msg "Please select a correct choice!";; + esac + done +} + +function remove_guppyflo(){ + guppyflo_message + local yn + while true; do + remove_msg "GuppyFLO" yn + case "${yn}" in + Y|y) + echo -e "${white}" + if [ -f "$INITD_FOLDER"/S99guppyflo ]; then + echo -e "Info: Stopping GuppyFLO service..." + /etc/init.d/S99guppyflo stop &> /dev/null + fi + echo -e "Info: Removing files..." + rm -rf "$GUPPYFLO_FOLDER" + rm -f "$INITD_FOLDER"/S99guppyflo + rm -f /lib/libeinfo.so.1 + rm -f /lib/librc.so.1 + ok_msg "GuppyFLO 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 diff --git a/scripts/menu/KE/info_menu_KE.sh b/scripts/menu/KE/info_menu_KE.sh index 0b4b5dd..297129b 100755 --- a/scripts/menu/KE/info_menu_KE.sh +++ b/scripts/menu/KE/info_menu_KE.sh @@ -47,6 +47,7 @@ function info_menu_ui_ke() { info_line "$(check_folder_ke "$OCTOEVERYWHERE_FOLDER")" 'OctoEverywhere' info_line "$(check_folder_ke "$MOONRAKER_OBICO_FOLDER")" 'Obico' info_line "$(check_folder_ke "$MOBILERAKER_COMPANION_FOLDER")" 'Mobileraker Companion' + info_line "$(check_folder_ke "$GUPPYFLO_FOLDER")" 'GuppyFLO' 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 f33a08d..eb111e9 100755 --- a/scripts/menu/KE/install_menu_KE.sh +++ b/scripts/menu/KE/install_menu_KE.sh @@ -29,6 +29,7 @@ function install_menu_ui_ke() { menu_option '11' 'Install' 'OctoEverywhere' menu_option '12' 'Install' 'Moonraker Obico' menu_option '13' 'Install' 'Mobileraker Companion' + menu_option '14' 'Install' 'GuppyFLO' hr inner_line hr @@ -150,6 +151,12 @@ function install_menu_ke() { else run "install_mobileraker_companion" "install_menu_ui_ke" fi;; + 14) + if [ ! -d "$MOONRAKER_FOLDER" ] && [ ! -d "$NGINX_FOLDER" ]; then + error_msg "Moonraker and Nginx are needed, please install them first!" + else + run "install_guppyflo" "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 e870630..f25608d 100755 --- a/scripts/menu/KE/remove_menu_KE.sh +++ b/scripts/menu/KE/remove_menu_KE.sh @@ -29,6 +29,7 @@ function remove_menu_ui_ke() { menu_option '11' 'Remove' 'OctoEverywhere' menu_option '12' 'Remove' 'Moonraker Obico' menu_option '13' 'Remove' 'Mobileraker Companion' + menu_option '14' 'Remove' 'GuppyFLO' hr inner_line hr @@ -146,6 +147,12 @@ function remove_menu_ke() { else run "remove_mobileraker_companion" "remove_menu_ui_ke" fi;; + 14) + if [ ! -d "$GUPPYFLO_FOLDER" ]; then + error_msg "GuppyFLO is not installed!" + else + run "remove_guppyflo" "remove_menu_ui_ke" + fi;; B|b) clear; main_menu; break;; Q|q) diff --git a/scripts/menu/info_menu.sh b/scripts/menu/info_menu.sh index 7aa3981..2b21b02 100755 --- a/scripts/menu/info_menu.sh +++ b/scripts/menu/info_menu.sh @@ -55,6 +55,7 @@ function info_menu_ui() { info_line "$(check_folder "$OCTOEVERYWHERE_FOLDER")" 'OctoEverywhere' info_line "$(check_folder "$MOONRAKER_OBICO_FOLDER")" 'Obico' info_line "$(check_folder "$MOBILERAKER_COMPANION_FOLDER")" 'Mobileraker Companion' + info_line "$(check_folder "$GUPPYFLO_FOLDER")" 'GuppyFLO' 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 5e16e00..2d7b297 100755 --- a/scripts/menu/install_menu.sh +++ b/scripts/menu/install_menu.sh @@ -37,6 +37,7 @@ function install_menu_ui() { menu_option '19' 'Install' 'OctoEverywhere' menu_option '20' 'Install' 'Moonraker Obico' menu_option '21' 'Install' 'Mobileraker Companion' + menu_option '22' 'Install' 'GuppyFLO' hr inner_line hr @@ -216,6 +217,12 @@ function install_menu() { else run "install_mobileraker_companion" "install_menu_ui" fi;; + 22) + if [ ! -d "$MOONRAKER_FOLDER" ] && [ ! -d "$NGINX_FOLDER" ]; then + error_msg "Moonraker and Nginx are needed, please install them first!" + else + run "install_guppyflo" "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 a5c5bb8..a52d71e 100755 --- a/scripts/menu/remove_menu.sh +++ b/scripts/menu/remove_menu.sh @@ -37,6 +37,7 @@ function remove_menu_ui() { menu_option '19' 'Remove' 'OctoEverywhere' menu_option '20' 'Remove' 'Moonraker Obico' menu_option '21' 'Remove' 'Mobileraker Companion' + menu_option '22' 'Remove' 'GuppyFLO' hr inner_line hr @@ -208,6 +209,12 @@ function remove_menu() { else run "remove_mobileraker_companion" "remove_menu_ui" fi;; + 22) + if [ ! -d "$GUPPYFLO_FOLDER" ]; then + error_msg "GuppyFLO is not installed!" + else + run "remove_guppyflo" "remove_menu_ui" + fi;; B|b) clear; main_menu; break;; Q|q) diff --git a/scripts/paths.sh b/scripts/paths.sh index edeaf0d..c3120b7 100755 --- a/scripts/paths.sh +++ b/scripts/paths.sh @@ -143,6 +143,10 @@ function set_paths() { MOBILERAKER_COMPANION_FOLDER="${USR_DATA}/mobileraker_companion" MOBILERAKER_COMPANION_URL="https://github.com/Clon1998/mobileraker_companion.git" + # GuppyFLO # + GUPPYFLO_FOLDER="${USR_DATA}/guppyflo" + GUPPYFLO_URL="https://github.com/ballaswag/guppyflo/releases/latest/download/guppyflo_mipsle.zip" + # Custom Boot Display # BOOT_DISPLAY_FOLDER="/etc/boot-display" BOOT_DISPLAY_FILE="${BOOT_DISPLAY_FOLDER}/part0/pic_100.jpg" diff --git a/scripts/tools.sh b/scripts/tools.sh index 01fcb56..4263604 100755 --- a/scripts/tools.sh +++ b/scripts/tools.sh @@ -358,6 +358,9 @@ function clear_logs(){ rm -f "$USR_DATA"/creality/userdata/log/*.gz rm -f "$USR_DATA"/creality/userdata/fault_code/* rm -f "$PRINTER_DATA_FOLDER"/logs/* + if [ -d "$GUPPYFLO_FOLDER" ]; then + rm -f "$GUPPYFLO_FOLDER"/guppyflo.log + fi ok_msg "Logs files have been cleared!" return;; N|n)