busybox: add initial support for shutdown scripts

Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
Stephan Raue 2011-09-07 23:08:11 +02:00
parent 8070fdd44a
commit 18a4b9e055

View File

@ -46,6 +46,8 @@
progress "Starting Init Scripts" progress "Starting Init Scripts"
RET=0 RET=0
RUNLEVEL="boot"
for script in `ls -1 /etc/init.d/*`; do for script in `ls -1 /etc/init.d/*`; do
if grep -q -e "^# runlevels:.*$MODE" $script; then if grep -q -e "^# runlevels:.*$MODE" $script; then
. $script . $script
@ -53,3 +55,15 @@
test $S_RET -ge $RET && RET=$S_RET test $S_RET -ge $RET && RET=$S_RET
fi fi
done done
if [ -z "$RUNLEVEL" -o $RUNLEVEL="boot" ]; then
RUNLEVEL="poweroff"
fi
for script in `ls -r1 /etc/init.d/*`; do
if grep -q -e "^# runlevels:.*$MODE" $script; then
. $script
S_RET=$?
test $S_RET -ge $RET && RET=$S_RET
fi
done