diff options
author | tnut <thierryn1 at hispeed dot ch> | 2010-06-19 15:56:28 +0200 |
---|---|---|
committer | tnut <thierryn1 at hispeed dot ch> | 2010-06-19 15:56:28 +0200 |
commit | f09460801e37f998e4f077dcf3b05bf98961f145 (patch) | |
tree | 1cd0cbcdb61d09cea1130406ae5dabd3fd26f6d6 /base/aaabasicfs/rc | |
parent | 13678d1cd7da97bd6d8d2a8e3dc82bf23f855542 (diff) | |
download | nutyx-extra-f09460801e37f998e4f077dcf3b05bf98961f145.tar.gz nutyx-extra-f09460801e37f998e4f077dcf3b05bf98961f145.tar.bz2 nutyx-extra-f09460801e37f998e4f077dcf3b05bf98961f145.tar.xz nutyx-extra-f09460801e37f998e4f077dcf3b05bf98961f145.zip |
maj aaabasicfs#2010-rc2
Diffstat (limited to 'base/aaabasicfs/rc')
-rwxr-xr-x | base/aaabasicfs/rc | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/base/aaabasicfs/rc b/base/aaabasicfs/rc new file mode 100755 index 000000000..56d61c399 --- /dev/null +++ b/base/aaabasicfs/rc @@ -0,0 +1,116 @@ +#!/bin/sh +######################################################################## +# Begin $rc_base/init.d/rc +# +# Description : Main Run Level Control Script +# +# Authors : Gerard Beekmans - gerard@linuxfromscratch.org +# +# Version : 00.00 +# +# Notes : +# +######################################################################## + +. /etc/sysconfig/rc +. ${rc_functions} + +stty sane + +trap "" INT QUIT TSTP + +[ "${1}" != "" ] && runlevel=${1} + +STEPS_DIR=/lib/init/rw/splashy +SPL_UPD=/sbin/splashy_update + + +splashy_update_progress(){ + STEPS_DIR=/lib/init/rw/splashy + SPL_UPD=/sbin/splashy_update + SPL_PRG=$STEPS_DIR/${runlevel}-progress + # load some default variables + [ -r "/etc/default/splashy" ] && . "/etc/default/splashy" + if ! ( pidof splashy > /dev/null ); then + /sbin/splashy boot 2>/dev/null + sleep 1 + else + PER=`sed -n 's+'${1}' ++ p' $SPL_PRG` + $SPL_UPD "progress $PER" + fi +} + +if [ "${runlevel}" = "" ]; then + echo "Usage: ${0} <runlevel>" >&2 + exit 1 +fi + +previous=${PREVLEVEL} +[ "${previous}" = "" ] && previous=N + +if [ ! -d ${rc_base}/rc${runlevel}.d ]; then + boot_mesg "${rc_base}/rc${runlevel}.d does not exist." ${WARNING} + boot_mesg_flush + exit 1 +fi +# Attempt to stop all service started by previous runlevel, +# and killed in this runlevel +if [ "${previous}" != "N" ]; then + for i in $(ls -v ${rc_base}/rc${runlevel}.d/K* 2> /dev/null) + do + check_script_status + + suffix=${i#$rc_base/rc$runlevel.d/K[0-9][0-9]} + prev_start=$rc_base/rc$previous.d/S[0-9][0-9]$suffix + sysinit_start=$rc_base/rcsysinit.d/S[0-9][0-9]$suffix + + if [ "${runlevel}" != "0" ] && [ "${runlevel}" != "6" ]; then + if [ ! -f ${prev_start} ] && [ ! -f ${sysinit_start} ]; then + boot_mesg -n "WARNING:\n\n${i} can't be" ${WARNING} + boot_mesg -n " executed because it was not" + boot_mesg -n " not started in the previous" + boot_mesg -n " runlevel (${previous})." + boot_mesg "" ${NORMAL} + boot_mesg_flush + continue + fi + fi + ${i} stop + error_value=${?} + + if [ "${error_value}" != "0" ]; then + print_error_msg + fi + done +fi + +#Start all functions in this runlevel +for i in $( ls -v ${rc_base}/rc${runlevel}.d/S* 2> /dev/null) +do + if [ "${previous}" != "N" ]; then + suffix=${i#$rc_base/rc$runlevel.d/S[0-9][0-9]} + stop=$rc_base/rc$runlevel.d/K[0-9][0-9]$suffix + prev_start=$rc_base/rc$previous.d/S[0-9][0-9]$suffix + + [ -f ${prev_start} ] && [ ! -f ${stop} ] && continue + fi + + check_script_status + + case ${runlevel} in + 0|6) + [ -f /sbin/splashy ] && splashy_update_progress ${i} + ${i} stop + ;; + *) + [ -f /sbin/splashy ] && splashy_update_progress ${i} + ${i} start + ;; + esac + error_value=${?} + + if [ "${error_value}" != "0" ]; then + print_error_msg + fi +done +# End $rc_base/init.d/rc |