Files
LibreELEC.tv/packages/sysutils/busybox/scripts/init.initramfs
2009-08-09 01:13:42 +02:00

54 lines
1.6 KiB
Bash
Executable File

#!/bin/sh
/bin/busybox mount -t proc none /proc
/bin/busybox mount -t sysfs none /sys
BOOT=`/bin/busybox cat /proc/cmdline | /bin/busybox sed 's/.*boot=// ; s/ .*//'`
DISK=`/bin/busybox cat /proc/cmdline | /bin/busybox sed 's/.*disk=// ; s/ .*//'`
# /bin/busybox mdev -s
/bin/busybox mount -o ro,noatime $BOOT /flash
/bin/busybox mount -o rw,noatime $DISK /storage
# /bin/busybox mount -t ramfs none /storage
if [ -f "/storage/.update/openelec.kernel" ]; then
echo "updating Kernel..."
/bin/busybox mount -o remount,rw /flash
/bin/busybox mv /storage/.update/openelec.kernel /flash/openelec.kernel
/bin/busybox mount -o remount,ro /flash
/bin/busybox sync
echo "... done"
echo "System reboots now"
/bin/busybox reboot
fi
# /bin/busybox sleep 5
if [ -f "/storage/.update/openelec.system" ]; then
echo "updating System..."
/bin/busybox mount -o remount,rw /flash
/bin/busybox mv /storage/.update/openelec.system /flash/openelec.system
/bin/busybox mount -o remount,ro /flash
/bin/busybox sync
echo "... done"
fi
if [ -f "/flash/openelec.system" ]; then
/bin/busybox mount /flash/openelec.system /sysroot
if [ $? -ne 0 ] ; then
echo "Could not mount system on /sysroot. Starting debugging shell..."
/bin/busybox sh </dev/tty1 >/dev/tty1 2>&1
fi
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 /sbin/init.system
echo "Error in initramfs. Starting debugging shell..."
/bin/busybox sh </dev/tty1 >/dev/tty1 2>&1