From 1a74fef31450af6f9896044866fa368a31d1e71d Mon Sep 17 00:00:00 2001 From: Alessandro Maggi Date: Sat, 8 Jun 2024 11:03:53 +0200 Subject: [PATCH] feat(spoolman): add installation status --- scripts/spoolman.sh | 22 ++++++++++++++++++++++ scripts/ui/main_menu.sh | 1 + 2 files changed, 23 insertions(+) diff --git a/scripts/spoolman.sh b/scripts/spoolman.sh index 1bf17d4..e60411d 100644 --- a/scripts/spoolman.sh +++ b/scripts/spoolman.sh @@ -183,3 +183,25 @@ function start_install_script() { fi } +function get_spoolman_status() { + local -a files + files=( + "${SPOOLMAN_DIR}" + "${SYSTEMD}/Spoolman.service" + ) + + local count + count=0 + + for file in "${files[@]}"; do + [[ -e "${file}" ]] && count=$(( count +1 )) + done + + if [[ "${count}" -eq "${#files[*]}" ]]; then + echo "Installed" + elif [[ "${count}" -gt 0 ]]; then + echo "Incomplete!" + else + echo "Not installed!" + fi +} diff --git a/scripts/ui/main_menu.sh b/scripts/ui/main_menu.sh index f950f27..011a9ae 100755 --- a/scripts/ui/main_menu.sh +++ b/scripts/ui/main_menu.sh @@ -29,6 +29,7 @@ function main_ui() { echo -e "| | OctoEverywhere: $(print_status "octoeverywhere")|" echo -e "| | Mobileraker: $(print_status "mobileraker")|" echo -e "| | OctoApp: $(print_status "octoapp")|" + echo -e "| | Spoolman: $(print_status "spoolman")|" echo -e "| | |" echo -e "| | Octoprint: $(print_status "octoprint")|" hr