fix runlevel-system

This commit is contained in:
Stephan Raue 2009-03-18 21:16:49 +01:00
parent 09411d9782
commit 942089fa59
2 changed files with 21 additions and 24 deletions

View File

@ -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 >/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

View File

@ -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