]> pd.if.org Git - startuptools/blobdiff - scripts/functions.rc
fix empty module list handling
[startuptools] / scripts / functions.rc
index 031eaa17c9d90594974dba27a9907d8465ec564b..16fcc6ee13b40322e2ad27aaa030743c87290cb4 100644 (file)
@@ -1,24 +1,40 @@
+#!/bin/sh
+
+if [ "$USE_COLOR" = '1' ] && [ -x /usr/bin/tput ]; then
+red=$(tput setaf 1)
+green=$(tput setaf 2)
+off=$(tput sgr0)
+fi
+
+status_msg() {
+       printf "\r[$1]\n"
+}
+
 status_starting() {
-       echo -n "[      ] Starting $1"
+       printf "[      ] Starting $1"
 }
 
 status_begin() {
-       echo -n "[      ] $*"
+       printf "[      ] $*"
 }
 
 status_stopping() {
-       echo -n "[      ] Stopping $1"
+       printf "[      ] Stopping $1"
 }
 
 status_ok() {
-       echo    "\r[  OK  ]"
+       printf "\r[  ${green}OK${off}  ]\n"
 }
 
 status_fail() {
-       echo    "\r[FAILED]"
+       printf "\r[${red}FAILED${off}]\n"
 }
 
 status_check() {
-       local r=$1
-       test ${r:=$?} -eq 0 && status_ok || status_fail
+       test $? -eq 0 && status_ok || status_fail
+}
+
+is_true() {
+   [ "$1" = "1" ] || [ "$1" = "yes" ] || [ "$1" = "true" ] ||  [ "$1" = "y" ] ||
+   [ "$1" = "t" ]
 }