Files
Arch-R/packages/sysutils/busybox/scripts/init
Stephan Raue 837b13f07b busybox/ busybox-initramfs:
- mount partions in initramfs and move the partions to sysroot (faster boot)
- rename system and kernel file
- update now updates kernel and system in the some process, and then reboot if needed
- dont start xorg in textmode
2009-11-29 06:02:55 +01:00

72 lines
1.8 KiB
Bash
Executable File

#!/bin/sh
# read config
. /etc/sysconfig
# mounting storage
# todo
# mounting needed filesystems
/bin/mount -n -t ramfs none /var
# 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 # for polkit
install -m 755 -d /var/run/sepermit # for LinuxPAM
install -m 700 -d /var/lib/DeviceKit-disks # for DeviceKit-disks
install -m 700 -d /var/run/DeviceKit-disks # for DeviceKit-disks
# starting Xorg
[ ! "$TEXTMODE" = "yes" ] && 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