mirror of
https://github.com/archr-linux/Arch-R.git
synced 2026-03-31 14:41:55 -07:00
71 lines
1.5 KiB
Bash
Executable File
71 lines
1.5 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
/bin/busybox test ! -e /proc/cpuinfo && \
|
|
/bin/busybox mount -t proc none /proc
|
|
/bin/busybox test ! -e /sys/kernel && \
|
|
/bin/busybox mount -t sysfs none /sys
|
|
|
|
export PATH=/bin:/sbin:/usr/bin:/usr/sbin
|
|
|
|
mount -t ramfs none /dev
|
|
mount -t ramfs none /var
|
|
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
|
|
textmode)
|
|
TEXTMODE=yes
|
|
;;
|
|
configure)
|
|
CONFIGURE=yes
|
|
;;
|
|
esac
|
|
done
|
|
|
|
# make variable directory structure
|
|
mkdir -p /var/run
|
|
mkdir -p /var/log
|
|
mkdir -p /var/lock
|
|
mkdir -p /var/tmp
|
|
mkdir -p /var/mnt
|
|
|
|
# setting hostname
|
|
echo openelec > /proc/sys/kernel/hostname
|
|
|
|
# copying config into ram
|
|
[ -f "/usr/config/etc.tar.lzma" ] && \
|
|
tar xaf "/usr/config/etc.tar.lzma" -C /storage
|
|
|
|
RUNLEVEL="openelec"
|
|
if test "$TEXTMODE" = yes; then
|
|
RUNLEVEL="text"
|
|
elif test "$CONFIGURE" = yes; then
|
|
RUNLEVEL="configure"
|
|
fi
|
|
|
|
count=0
|
|
for script in /etc/init.d/*; do
|
|
grep -q -e "^# runlevels:.*$RUNLEVEL" $script && count=$(($count+1));
|
|
done
|
|
|
|
RET=0
|
|
|
|
for script in /etc/init.d/*; do
|
|
if grep -q -e "^# runlevels:.*$RUNLEVEL" $script; then
|
|
/bin/sh $script
|
|
S_RET=$?
|
|
test $S_RET -ge $RET && RET=$S_RET
|
|
fi
|
|
done
|
|
|
|
exit $RET
|
|
|
|
echo "starting emergency shell"
|
|
exec /bin/busybox sh </dev/tty3 >/dev/tty3 2>&1
|