From 72312422e3294867d1054a3bada9bd7023ad3a22 Mon Sep 17 00:00:00 2001 From: th33xitus Date: Sun, 13 Jun 2021 11:59:12 +0200 Subject: [PATCH] fix: performance improvement for loading the advanced menu ui --- scripts/functions.sh | 3 +++ scripts/ui/advanced_menu.sh | 8 +++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/scripts/functions.sh b/scripts/functions.sh index 455ebe5..2817126 100755 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -248,6 +248,9 @@ toggle_octoprint_service(){ read_octoprint_service_status(){ unset OPRINT_SERVICE_STATUS + if [ ! -f "/etc/systemd/system/octoprint.service" ]; then + return 0 + fi if systemctl list-unit-files | grep -E "octoprint*" | grep "enabled" &>/dev/null; then OPRINT_SERVICE_STATUS="${red}[Disable]${default} OctoPrint Service " else diff --git a/scripts/ui/advanced_menu.sh b/scripts/ui/advanced_menu.sh index 05602c2..01dc2b0 100755 --- a/scripts/ui/advanced_menu.sh +++ b/scripts/ui/advanced_menu.sh @@ -2,9 +2,11 @@ advanced_ui(){ top_border echo -e "| ${yellow}~~~~~~~~~~~~~ [ Advanced Menu ] ~~~~~~~~~~~~~${default} | " hr - echo -e "| 0) $OPRINT_SERVICE_STATUS| " - hr - echo -e "| | | " + if [ ! "$OPRINT_SERVICE_STATUS" == "" ]; then + echo -e "| 0) $OPRINT_SERVICE_STATUS| " + hr + echo -e "| | | " + fi echo -e "| Klipper: | Mainsail: | " echo -e "| 1) [Switch Branch] | 7) [Theme installer] | " echo -e "| 2) [Rollback] | | "