mirror of
https://github.com/archr-linux/Arch-R.git
synced 2026-03-31 14:41:55 -07:00
- merge with package busybox - add patch to enhance fbsplash - add more patches from busybox.net
86 lines
1.9 KiB
Bash
Executable File
86 lines
1.9 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
# funktions
|
|
mount_sys() {
|
|
if ! /bin/mountpoint -q $1; then
|
|
# echo "### $1 does not exist, create it ###"
|
|
/bin/mount -t $2 none $1
|
|
fi
|
|
}
|
|
|
|
# mounting needed filesystems
|
|
mount_sys "/dev" "devtmpfs"
|
|
mount_sys "/proc" "proc"
|
|
mount_sys "/sys" "sysfs"
|
|
mount_sys "/var" "ramfs"
|
|
|
|
# setting up $PATH
|
|
export PATH=/bin:/sbin:/usr/bin:/usr/sbin
|
|
|
|
# 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
|
|
;;
|
|
debugging)
|
|
DEBUG=yes
|
|
;;
|
|
esac
|
|
done
|
|
|
|
# starting debugging shell
|
|
if test "$DEBUG" = yes; then
|
|
echo "### starting debugging shell on console 3 ###"
|
|
echo "### ...... switch with ctrl-alt-f3 ...... ###"
|
|
exec /bin/sh </dev/tty3 >/dev/tty3 2>&1 &
|
|
fi
|
|
|
|
# make variable directory structure
|
|
install -m 1777 -d /var/run
|
|
install -m 755 -d /var/log
|
|
install -m 755 -d /var/lock
|
|
install -m 1777 -d /var/tmp
|
|
install -m 755 -d /var/media
|
|
|
|
# setting hostname
|
|
echo localhost > /proc/sys/kernel/hostname
|
|
|
|
echo 0 > /proc/sys/dev/cdrom/autoclose
|
|
echo 0 > /proc/sys/dev/cdrom/lock
|
|
|
|
# copying config into ram
|
|
[ -f "/usr/config/etc.tar.lzma" ] && \
|
|
tar xaf "/usr/config/etc.tar.lzma" -C /var
|
|
|
|
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/sh </dev/tty3 >/dev/tty3 2>&1
|