From c527fd1f14c27855a37f2e8ac5346ce8d940ced2 Mon Sep 17 00:00:00 2001 From: Tudor Florea Date: Thu, 16 Oct 2014 03:05:19 +0200 Subject: initial commit for Enea Linux 4.0-140929 Migrated from the internal git server on the daisy-enea-point-release branch Signed-off-by: Tudor Florea --- .../initscripts/initscripts-1.0/functions | 91 ++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100755 meta/recipes-core/initscripts/initscripts-1.0/functions (limited to 'meta/recipes-core/initscripts/initscripts-1.0/functions') diff --git a/meta/recipes-core/initscripts/initscripts-1.0/functions b/meta/recipes-core/initscripts/initscripts-1.0/functions new file mode 100755 index 0000000000..01ad1edd3e --- /dev/null +++ b/meta/recipes-core/initscripts/initscripts-1.0/functions @@ -0,0 +1,91 @@ +# -*-Shell-script-*- +# +# 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: +# 1) If there is no "pidof -x", replace the "pidof $1" with another +# command like(for core-image-minimal): +# ps | awk '/'"$1"'/ {print $1}' +# Or +# 2) If there is "pidof -x", replace "pidof" with "pidof -x". +# +# pidofproc - print the pid of a process +# $1: the name of the process +pidofproc () { + + # pidof output null when no program is running, so no "2>/dev/null". + pid=`pidof $1` + status=$? + case $status in + 0) + echo $pid + return 0 + ;; + 127) + echo "ERROR: command pidof not found" >&2 + exit 127 + ;; + *) + return $status + ;; + esac +} + +machine_id() { # return the machine ID + awk 'BEGIN { FS=": " } /Hardware/ \ + { gsub(" ", "_", $2); print tolower($2) } '