mirror of
https://github.com/archr-linux/Arch-R.git
synced 2026-03-31 14:41:55 -07:00
73 lines
1.9 KiB
Bash
Executable File
73 lines
1.9 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
# read config
|
|
. /etc/sysconfig
|
|
|
|
HOSTNAME="openelec"
|
|
|
|
# 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 755 -d /var/run/sepermit # for LinuxPAM
|
|
|
|
# bring lo up, whether we have network card or not
|
|
ifconfig lo 127.0.0.1 up
|
|
|
|
# create /etc/hosts file, useful for gethostbyname(localhost)
|
|
echo -e "127.0.0.1\tlocalhost $HOSTNAME" > /var/run/hosts
|
|
|
|
# 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 "#############################################"
|
|
echo "### it seems we are running in Debug mode ###"
|
|
echo "### starting debugging shell on console 3 ###"
|
|
echo "### ...... switch with ctrl-alt-f3 ...... ###"
|
|
echo "#############################################"
|
|
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
|
|
RET=0
|
|
|
|
for script in /etc/init.d/*; do
|
|
if grep -q -e "^# runlevels:.*$RUNLEVEL" $script; then
|
|
. $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 "###################################"
|
|
echo "### it seems we have an problem ###"
|
|
echo "### starting emergency shell... ###"
|
|
echo "###################################"
|
|
exec /bin/sh </dev/tty3 >/dev/tty3 2>&1
|