From 243da4b2d856a379a24ead6e31d811378c4b6b63 Mon Sep 17 00:00:00 2001 From: Salt Date: Thu, 20 Aug 2020 05:41:45 -0500 Subject: [PATCH] Improve firestarter status output --- firestarter | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/firestarter b/firestarter index 3f0d219..674d1e7 100755 --- a/firestarter +++ b/firestarter @@ -149,7 +149,8 @@ fslist() { fsstatus() { # List statistics about firestarter if [ -z "$FIRESTARTER" ]; then - error "Firestarter is not currently running" 56 + printf "\e[31m●\e[0m Not running\n" + exit 1 fi # Current process status local psline @@ -163,13 +164,35 @@ fsstatus() { local displayline if [ "$FIRESTARTER_DISPLAY" == "$DISPLAY" ]; then displayline="On display: \e[32m$FIRESTARTER_DISPLAY\e[0m" + elif [ -z "$FIRESTARTER_DISPLAY" ]; then + displayline="On display: \e[31mUnset\e[0m" else displayline="On display: \e[31m$FIRESTARTER_DISPLAY\e[0m (currently on $DISPLAY)" fi printf "\t$displayline\n" # Configuration information - if [ -n "$FS_DIEONWM" ] && gettarget "$_optconfigdir/wm"; then - printf "\tWill die when \e[34m$_return\e[0m exits\n" + if [ -n "$FS_DIEONWM" ]; then + if gettarget "$_optconfigdir/wm"; then + printf "\tWill die when \e[34m$_return\e[0m exits\n" + else + local targeterror=$? + local errorline="\t\e[31mFS_DIEONWM is set but" + case $targeterror in + 2) + errorline="$errorline wm has no matches" + ;; + 50) + errorline="$errorline wm is not a Firestarter service" + ;; + 51) + errorline="$errorline wm is disabled" + ;; + *) + errorline="$errorline wm did not resolve" + ;; + esac + printf "$errorline\n" + fi fi } step_preexecute() {