diff options
-rwxr-xr-x[-rw-r--r--] | meta/recipes-core/initscripts/initscripts-1.0/functions | 31 |
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 @@ | |||
3 | # functions This file contains functions to be used by most or all | 3 | # functions This file contains functions to be used by most or all |
4 | # shell scripts in the /etc/init.d directory. | 4 | # shell scripts in the /etc/init.d directory. |
5 | # | 5 | # |
6 | |||
7 | NORMAL="\\033[0;39m" # Standard console grey | ||
8 | SUCCESS="\\033[1;32m" # Success is green | ||
9 | WARNING="\\033[1;33m" # Warnings are yellow | ||
10 | FAILURE="\\033[1;31m" # Failures are red | ||
11 | INFO="\\033[1;36m" # Information is light cyan | ||
12 | BRACKET="\\033[1;34m" # Brackets are blue | ||
13 | |||
6 | # NOTE: The pidofproc () doesn't support the process which is a script unless | 14 | # NOTE: The pidofproc () doesn't support the process which is a script unless |
7 | # the pidof supports "-x" option. If you want to use it for such a | 15 | # the pidof supports "-x" option. If you want to use it for such a |
8 | # process: | 16 | # process: |
@@ -58,3 +66,26 @@ status() { | |||
58 | fi | 66 | fi |
59 | return 3 | 67 | return 3 |
60 | } | 68 | } |
69 | |||
70 | success() { | ||
71 | echo -n -e "${BRACKET}[${SUCCESS} OK ${BRACKET}]${NORMAL}" | ||
72 | return 0 | ||
73 | } | ||
74 | |||
75 | failure() { | ||
76 | local rc=$* | ||
77 | echo -n -e "${BRACKET}[${FAILURE} FAIL ${BRACKET}]${NORMAL}" | ||
78 | return $rc | ||
79 | } | ||
80 | |||
81 | warning() { | ||
82 | local rc=$* | ||
83 | echo -n -e "${BRACKET}[${WARNING} WARN ${BRACKET}]${NORMAL}" | ||
84 | return $rc | ||
85 | } | ||
86 | |||
87 | passed() { | ||
88 | local rc=$* | ||
89 | echo -n -e "${BRACKET}[${SUCCESS} PASS ${BRACKET}]${NORMAL}" | ||
90 | return $rc | ||
91 | } | ||