--- trunk/magellan-initscripts/etc/rc.d/init.d/functions 2009/11/05 12:57:14 931 +++ trunk/initscripts/sysvinit/rc/functions 2012/03/03 16:00:17 1774 @@ -40,25 +40,22 @@ COLOREDSTAR="${COLBLUE}(${COLGREEN}*${COLBLUE})${COLDEFAULT} " -#location to save the started services +# location to save the started services svcdir="/var/lib/init.d" svclib="/lib/rcscripts" svcmount="no" svcfstype="tmpfs" svcsize=1024 +rc_echo() { echo $@; } +rc_print() { rc_echo -e "${COLOREDSTAR}$@"; } # dummy function; needed if splashutils are not installed -splash() { - return 0 -} +splash() { return 0; } - -#source splash functions if exists +# source splash functions if exists [ -f /etc/init.d/splash-functions ] && source /etc/init.d/splash-functions - - print_error_msg() { return 0 @@ -98,7 +95,6 @@ local SVCD_INITSCRIPT local x - #do this only if proc is mounted [ ! -f /proc/mounts ] && return 0 @@ -145,6 +141,11 @@ print_status success else print_status failure + + if [[ ${SPLASH_VERBOSE_ON_ERRORS} = 1 ]] + then + splash "rc_verbose" "${runlevel}" + fi fi return ${error_value} @@ -202,8 +203,15 @@ getpids() { - base=${1##*/} - pidlist=$(pidof -o $$ -o $PPID -x $base) + local base=${1##*/} + local opts + if [[ $(readlink /bin/pidof) = *busybox ]] + then + opts="" + else + opts="-x" + fi + pidlist=$(pidof -o $$ -o $PPID ${opts} $base) } loadproc() @@ -265,7 +273,7 @@ done base=${1##*/} - if [ $failure = 0 ]; then rm -f /var/run/$base.pid; fi + if [ $failure = 0 ]; then rm -f /run/$base.pid; fi (exit $failure) evaluate_retval @@ -288,7 +296,6 @@ else signal=${2##-} signal=${signal##SIG} - fi getpids $1 @@ -325,9 +332,9 @@ then echo "$base is running with Process ID(s) $pidlist" else - if [ -s /var/run/$base.pid ] + if [ -s /run/$base.pid ] then - echo "$1 is not running but /var/run/$base.pid exists" + echo "$1 is not running but /run/$base.pid exists" return 1 else echo "$1 is not running" @@ -398,7 +405,8 @@ } # searches /proc/mounts for mounted fstypes (like ext3) -is_fstype_mounted() { +is_fstype_mounted() +{ local filesys local i filesys=$1 @@ -410,7 +418,8 @@ } # searches /proc/mounts for mounted fs names (like udev, proc) -is_fs_mounted() { +is_fs_mounted() +{ local filesys local i filesys=$1 @@ -422,7 +431,8 @@ } # checks if kernel supports fs xy -kernel_supports_fs() { +kernel_supports_fs() +{ local filesys local i filesys=$1 @@ -439,7 +449,8 @@ # the reference file # # EXAMPLE: if is_older_than a.out *.o ; then ... -is_older_than() { +is_older_than() +{ local x= local ref="$1" shift @@ -456,3 +467,34 @@ return 1 } + +# read /etc/os-release file +# read_os_release $item +read_os_release() +{ + local NAME + local ID + local Version + local Version_ID + local PRETTY_NAME + local ANSI_COLOR + local CPE_NAME + + if [[ -f /etc/os-release ]] + then + source /etc/os-release + + case $1 in + name) echo "${NAME}" ;; + id) echo "${ID}" ;; + version) echo "${Version}" ;; + version_id) echo "${Version_ID}" ;; + pretty_name) echo "${PRETTY_NAME}" ;; + ansi_color) echo "${ANSI_COLOR}" ;; + cpe_name) echo "${CPE_NAME}" ;; + esac + fi +} + +start_devicemanager() { touch /dev/.none; return 0; } +stop_devicemanager() { return 0; }