Files
Arch-R/packages/sysutils/busybox/scripts/init
Stephan Raue 81da6ca44a busybox:
- reorg of init scripts
- remove start of not needed webserver
- remove patch for fbsplash
- various cleanups
2009-11-16 07:50:41 +01:00

72 lines
1.7 KiB
Bash
Executable File

#!/bin/sh
# mounting needed filesystems
/bin/mount -t devtmpfs none /dev
/bin/mount -t proc none /proc
/bin/mount -t sysfs none /sys
/bin/mount -t ramfs none /var
# read config
. /etc/sysconfig
# mounting storage
# todo
# make variable directory structure
install -m 755 -d /var/log
install -m 755 -d /var/lock
install -m 755 -d /var/media
install -m 1777 -d /var/run
install -m 1777 -d /var/tmp
# install -m 700 -d /var/lib/polkit-1
# starting Xorg
start_xorg
# copying config into storage
mkdir -p $HOME/.config
for i in `ls /usr/config`; do
[ ! -f "$HOME/.config/$i" ] && \
cp -PR /usr/config/$i $HOME/.config
done
# setting hostname
echo localhost > /proc/sys/kernel/hostname
# starting debugging shell
# if test "$DEBUG" = yes; then
# echo "### it seems we are running in Debug mode ###"
# echo "### starting debugging shell on console 3 ###"
# echo "### ...... switch with ctrl-alt-f3 ...... ###"
exec /bin/sh </dev/tty3 >/dev/tty3 2>&1 &
# fi
# getting runlevel
RUNLEVEL="openelec"
if test "$TEXTMODE" = yes; then
RUNLEVEL="text"
elif test "$CONFIGURE" = yes; then
RUNLEVEL="configure"
fi
# starting init scripts for wanted runlevel
count=0
for script in /sbin/init.d/*; do
grep -q -e "^# runlevels:.*$RUNLEVEL" $script && count=$(($count+1));
done
RET=0
for script in /sbin/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
# when we have an problem we must look where is this problem
echo "### it seems we have an problem ###"
echo "### starting emergency shell... ###"
exec /bin/sh </dev/tty3 >/dev/tty3 2>&1