Improve firestarter status output

This commit is contained in:
Salt 2020-08-20 05:41:45 -05:00
parent 3b60400b4d
commit 243da4b2d8

View File

@ -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() {