aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/initscripts
diff options
context:
space:
mode:
authorRoy Li <rongqing.li@windriver.com>2014-01-22 16:57:38 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-01-28 00:52:33 +0000
commit17e6df62d923aa50ae814b737e1b91224b2dd985 (patch)
tree3a6c389a3e10ae9473a5c3dc5bd0875239076cc4 /meta/recipes-core/initscripts
parente1780a29d0c88019692ca0094cf76fd6c7c70c8e (diff)
downloadopenembedded-core-contrib-17e6df62d923aa50ae814b737e1b91224b2dd985.tar.gz
initscripts: define failure/success/warning/pass functions
define failure/success/warning/pass functions, some packages' initscript need them, and /etc/core-lsb/lsb_log_message from lsb needs them too. (From OE-Core rev: b78154c4a52b5a198e90bca8f83990fe9251fb72) Signed-off-by: Roy Li <rongqing.li@windriver.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/initscripts')
-rwxr-xr-x[-rw-r--r--]meta/recipes-core/initscripts/initscripts-1.0/functions31
1 files changed, 31 insertions, 0 deletions
diff --git a/meta/recipes-core/initscripts/initscripts-1.0/functions b/meta/recipes-core/initscripts/initscripts-1.0/functions
index 8e15762f8a..01ad1edd3e 100644..100755
--- a/meta/recipes-core/initscripts/initscripts-1.0/functions
+++ b/meta/recipes-core/initscripts/initscripts-1.0/functions
@@ -3,6 +3,14 @@
# functions This file contains functions to be used by most or all
# shell scripts in the /etc/init.d directory.
#
+
+NORMAL="\\033[0;39m" # Standard console grey
+SUCCESS="\\033[1;32m" # Success is green
+WARNING="\\033[1;33m" # Warnings are yellow
+FAILURE="\\033[1;31m" # Failures are red
+INFO="\\033[1;36m" # Information is light cyan
+BRACKET="\\033[1;34m" # Brackets are blue
+
# NOTE: The pidofproc () doesn't support the process which is a script unless
# the pidof supports "-x" option. If you want to use it for such a
# process:
@@ -58,3 +66,26 @@ status() {
fi
return 3
}
+
+success() {
+ echo -n -e "${BRACKET}[${SUCCESS} OK ${BRACKET}]${NORMAL}"
+ return 0
+}
+
+failure() {
+ local rc=$*
+ echo -n -e "${BRACKET}[${FAILURE} FAIL ${BRACKET}]${NORMAL}"
+ return $rc
+}
+
+warning() {
+ local rc=$*
+ echo -n -e "${BRACKET}[${WARNING} WARN ${BRACKET}]${NORMAL}"
+ return $rc
+}
+
+passed() {
+ local rc=$*
+ echo -n -e "${BRACKET}[${SUCCESS} PASS ${BRACKET}]${NORMAL}"
+ return $rc
+}