From 942089fa59bb27fc5c2e0cf0593b6e258283f8f0 Mon Sep 17 00:00:00 2001 From: Stephan Raue Date: Wed, 18 Mar 2009 21:16:49 +0100 Subject: [PATCH] fix runlevel-system --- .../sysutils/busybox/scripts/init.initramfs | 23 +------------------ packages/sysutils/busybox/scripts/init.system | 22 ++++++++++++++++-- 2 files changed, 21 insertions(+), 24 deletions(-) diff --git a/packages/sysutils/busybox/scripts/init.initramfs b/packages/sysutils/busybox/scripts/init.initramfs index 1c0af16e08..8ca1f53aa2 100755 --- a/packages/sysutils/busybox/scripts/init.initramfs +++ b/packages/sysutils/busybox/scripts/init.initramfs @@ -6,18 +6,6 @@ BOOT=`/bin/busybox cat /proc/cmdline | /bin/busybox sed 's/.*boot=// ; s/ .*//'` DISK=`/bin/busybox cat /proc/cmdline | /bin/busybox sed 's/.*disk=// ; s/ .*//'` -# parse command line arguments -for arg in $(cat /proc/cmdline); do - case $arg in - debugging) - DEBUG=yes - ;; - configure) - CONFIGURE=yes - ;; - esac -done - /bin/busybox mdev -s /bin/busybox mount -t ext3 -o ro,noatime $BOOT /flash @@ -25,25 +13,16 @@ done if [ -f "/flash/openelec.system" ]; then /bin/busybox mount /flash/openelec.system /sysroot - INIT=/sbin/init.system if [ $? -ne 0 ] ; then echo Could not mount system on /sysroot. Starting debugging shell.... - INIT=/sbin/nosystem /bin/busybox sh /dev/tty1 2>&1 fi fi -RUNLEVEL="openelec" -if test "$DEBUG" = yes; then - RUNLEVEL="debug" -elif test "$CONFIGURE" = yes; then - RUNLEVEL="configure" -fi - /bin/busybox mount --bind /flash /sysroot/flash /bin/busybox mount --bind /storage /sysroot/storage /bin/busybox umount /proc /bin/busybox umount /sys - exec /bin/busybox switch_root /sysroot $INIT $RUNLEVEL + exec /bin/busybox switch_root /sysroot /sbin/init.system diff --git a/packages/sysutils/busybox/scripts/init.system b/packages/sysutils/busybox/scripts/init.system index 2e2546c4f1..55d8938883 100755 --- a/packages/sysutils/busybox/scripts/init.system +++ b/packages/sysutils/busybox/scripts/init.system @@ -12,10 +12,21 @@ mknod /dev/null c 1 3 mknod /dev/fb0 c 29 0 +# parse command line arguments BOOT=`cat /proc/cmdline | sed 's/.*boot=// ; s/ .*//'` DISK=`cat /proc/cmdline | sed 's/.*disk=// ; s/ .*//'` #VERSION=`cat /proc/version | cut -f3 -d" "` + for arg in $(cat /proc/cmdline); do + case $arg in + debugging) + DEBUG=yes + ;; + configure) + CONFIGURE=yes + ;; + esac + done # make variable directory structure mkdir -p /var/run @@ -31,15 +42,22 @@ [ -f "/usr/config/etc.tar.lzma" ] && \ tar xaf "/usr/config/etc.tar.lzma" -C /storage + RUNLEVEL="openelec" + if test "$DEBUG" = yes; then + RUNLEVEL="debug" + elif test "$CONFIGURE" = yes; then + RUNLEVEL="configure" + fi + count=0 for script in /etc/init.d/*; do - grep -q -e "^# runlevels:.*$1" $script && count=$(($count+1)); + grep -q -e "^# runlevels:.*$RUNLEVEL" $script && count=$(($count+1)); done RET=0 for script in /etc/init.d/*; do - if grep -q -e "^# runlevels:.*$1" $script; then + if grep -q -e "^# runlevels:.*$RUNLEVEL" $script; then /bin/sh $script S_RET=$? test $S_RET -ge $RET && RET=$S_RET