mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-28 13:16:41 +00:00
fix runlevel-system
This commit is contained in:
parent
09411d9782
commit
942089fa59
@ -6,18 +6,6 @@
|
|||||||
BOOT=`/bin/busybox cat /proc/cmdline | /bin/busybox sed 's/.*boot=// ; s/ .*//'`
|
BOOT=`/bin/busybox cat /proc/cmdline | /bin/busybox sed 's/.*boot=// ; s/ .*//'`
|
||||||
DISK=`/bin/busybox cat /proc/cmdline | /bin/busybox sed 's/.*disk=// ; 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 mdev -s
|
||||||
|
|
||||||
/bin/busybox mount -t ext3 -o ro,noatime $BOOT /flash
|
/bin/busybox mount -t ext3 -o ro,noatime $BOOT /flash
|
||||||
@ -25,25 +13,16 @@ done
|
|||||||
|
|
||||||
if [ -f "/flash/openelec.system" ]; then
|
if [ -f "/flash/openelec.system" ]; then
|
||||||
/bin/busybox mount /flash/openelec.system /sysroot
|
/bin/busybox mount /flash/openelec.system /sysroot
|
||||||
INIT=/sbin/init.system
|
|
||||||
if [ $? -ne 0 ] ; then
|
if [ $? -ne 0 ] ; then
|
||||||
echo Could not mount system on /sysroot. Starting debugging shell....
|
echo Could not mount system on /sysroot. Starting debugging shell....
|
||||||
INIT=/sbin/nosystem
|
|
||||||
/bin/busybox sh </dev/tty1 >/dev/tty1 2>&1
|
/bin/busybox sh </dev/tty1 >/dev/tty1 2>&1
|
||||||
fi
|
fi
|
||||||
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 /flash /sysroot/flash
|
||||||
/bin/busybox mount --bind /storage /sysroot/storage
|
/bin/busybox mount --bind /storage /sysroot/storage
|
||||||
|
|
||||||
/bin/busybox umount /proc
|
/bin/busybox umount /proc
|
||||||
/bin/busybox umount /sys
|
/bin/busybox umount /sys
|
||||||
|
|
||||||
exec /bin/busybox switch_root /sysroot $INIT $RUNLEVEL
|
exec /bin/busybox switch_root /sysroot /sbin/init.system
|
||||||
|
@ -12,10 +12,21 @@
|
|||||||
mknod /dev/null c 1 3
|
mknod /dev/null c 1 3
|
||||||
mknod /dev/fb0 c 29 0
|
mknod /dev/fb0 c 29 0
|
||||||
|
|
||||||
|
# parse command line arguments
|
||||||
BOOT=`cat /proc/cmdline | sed 's/.*boot=// ; s/ .*//'`
|
BOOT=`cat /proc/cmdline | sed 's/.*boot=// ; s/ .*//'`
|
||||||
DISK=`cat /proc/cmdline | sed 's/.*disk=// ; s/ .*//'`
|
DISK=`cat /proc/cmdline | sed 's/.*disk=// ; s/ .*//'`
|
||||||
#VERSION=`cat /proc/version | cut -f3 -d" "`
|
#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
|
# make variable directory structure
|
||||||
mkdir -p /var/run
|
mkdir -p /var/run
|
||||||
@ -31,15 +42,22 @@
|
|||||||
[ -f "/usr/config/etc.tar.lzma" ] && \
|
[ -f "/usr/config/etc.tar.lzma" ] && \
|
||||||
tar xaf "/usr/config/etc.tar.lzma" -C /storage
|
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
|
count=0
|
||||||
for script in /etc/init.d/*; do
|
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
|
done
|
||||||
|
|
||||||
RET=0
|
RET=0
|
||||||
|
|
||||||
for script in /etc/init.d/*; do
|
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
|
/bin/sh $script
|
||||||
S_RET=$?
|
S_RET=$?
|
||||||
test $S_RET -ge $RET && RET=$S_RET
|
test $S_RET -ge $RET && RET=$S_RET
|
||||||
|
Loading…
x
Reference in New Issue
Block a user