From bc658f38bca6fb21af9a6f474f667a8537fd2b3e Mon Sep 17 00:00:00 2001 From: th33xitus Date: Tue, 6 Oct 2020 21:04:35 +0200 Subject: [PATCH] fix: UI --- scripts/status.sh | 56 +++++++++++++++++++++++++++++++++++++---- scripts/ui/main_menu.sh | 11 +++++--- 2 files changed, 59 insertions(+), 8 deletions(-) diff --git a/scripts/status.sh b/scripts/status.sh index a772056..875d5d4 100755 --- a/scripts/status.sh +++ b/scripts/status.sh @@ -57,15 +57,38 @@ dwc2_status(){ fi } +moonraker_status(){ + mrcount=0 + moonraker_data=( + $MOONRAKER_SERVICE1 + $MOONRAKER_SERVICE2 + $MOONRAKER_DIR + $MOONRAKER_ENV_DIR + $NGINX_CONFD/upstreams.conf + $NGINX_CONFD/common_vars.conf + ) + #count+1 for each found data-item from array + for mrd in "${moonraker_data[@]}" + do + if [ -e $mrd ]; then + mrcount=$(expr $mrcount + 1) + fi + done + if [ "$mrcount" == "${#moonraker_data[*]}" ]; then + MOONRAKER_STATUS="${green}Installed!${default} " + elif [ "$mrcount" == 0 ]; then + MOONRAKER_STATUS="${red}Not installed!${default} " + else + MOONRAKER_STATUS="${yellow}Incomplete!${default} " + fi +} + mainsail_status(){ mcount=0 mainsail_data=( - $MOONRAKER_SERVICE1 - $MOONRAKER_SERVICE2 $MAINSAIL_DIR - $MOONRAKER_ENV_DIR - /etc/nginx/sites-available/mainsail - /etc/nginx/sites-enabled/mainsail + NGINX_SA/mainsail + NGINX_SE/mainsail ) #count+1 for each found data-item from array for md in "${mainsail_data[@]}" @@ -83,6 +106,29 @@ mainsail_status(){ fi } +fluidd_status(){ + fcount=0 + fluidd_data=( + $FLUIDD_DIR + NGINX_SA/fluidd + NGINX_SE/fluidd + ) + #count+1 for each found data-item from array + for fd in "${fluidd_data[@]}" + do + if [ -e $fd ]; then + fcount=$(expr $fcount + 1) + fi + done + if [ "$fcount" == "${#fluidd_data[*]}" ]; then + FLUIDD_STATUS="${green}Installed!${default} " + elif [ "$fcount" == 0 ]; then + FLUIDD_STATUS="${red}Not installed!${default} " + else + FLUIDD_STATUS="${yellow}Incomplete!${default} " + fi +} + octoprint_status(){ ocount=0 octoprint_data=( diff --git a/scripts/ui/main_menu.sh b/scripts/ui/main_menu.sh index 0844dec..c3280ec 100755 --- a/scripts/ui/main_menu.sh +++ b/scripts/ui/main_menu.sh @@ -6,9 +6,12 @@ main_ui(){ echo -e "| 1) [Install] | Klipper: $KLIPPER_STATUS|" echo -e "| 2) [Update] | Branch: ${cyan}$PRINT_BRANCH${default}|" echo -e "| 3) [Remove] | |" - echo -e "| | DWC2: $DWC2_STATUS|" - echo -e "| 4) [Advanced] | Mainsail: $MAINSAIL_STATUS|" - echo -e "| 5) [Backup] | Octoprint: $OCTOPRINT_STATUS|" + echo -e "| | Moonraker: $MOONRAKER_STATUS|" + echo -e "| 4) [Advanced] | |" + echo -e "| 5) [Backup] | DWC2: $DWC2_STATUS|" + echo -e "| | Fluidd: $FLUIDD_STATUS|" + echo -e "| | Mainsail: $MAINSAIL_STATUS|" + echo -e "| | Octoprint: $OCTOPRINT_STATUS|" echo -e "| | |" quit_footer } @@ -21,7 +24,9 @@ main_menu(){ fi #check install status klipper_status + moonraker_status dwc2_status + fluidd_status mainsail_status octoprint_status print_branch