| 1 |
#!/bin/bash
|
| 2 |
trap ":" INT QUIT TSTP
|
| 3 |
source /etc/init.d/functions.sh
|
| 4 |
#no /usr yet, very likely
|
| 5 |
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
| 6 |
umask 022
|
| 7 |
|
| 8 |
try() {
|
| 9 |
eval $*
|
| 10 |
if [ $? -ne 0 ]
|
| 11 |
then
|
| 12 |
echo -e "$ENDCOL$NORMAL[$BAD oops $NORMAL]"
|
| 13 |
echo
|
| 14 |
echo '!!! '"ERROR: the $1 command did not complete successfully."
|
| 15 |
echo '!!! '"(\" ${*} \")"
|
| 16 |
echo '!!! '"Since this is a critical task, startup cannot continue."
|
| 17 |
echo
|
| 18 |
/sbin/sulogin $CONSOLE
|
| 19 |
reboot -f
|
| 20 |
fi
|
| 21 |
}
|
| 22 |
|
| 23 |
mountshm() {
|
| 24 |
ebegin "Mounting tmpfs at /dev/shm"
|
| 25 |
try mount -n -t tmpfs tmpfs /dev/shm -o rw,mode=0644,size=4m
|
| 26 |
eend
|
| 27 |
}
|
| 28 |
|
| 29 |
if [ $$ -ne 1 ]
|
| 30 |
then
|
| 31 |
exec /sbin/init.system $*
|
| 32 |
fi
|
| 33 |
|
| 34 |
|
| 35 |
echo
|
| 36 |
echo -e "${GOOD}Gentoo Linux${GENTOO_VERS}; \e[34;01mhttp://www.gentoo.org${NORMAL}\n Copyright 2001 Gentoo Technologies, Inc.; Distributed under the GPL"
|
| 37 |
echo
|
| 38 |
|
| 39 |
ebegin "Mounting /proc"
|
| 40 |
mount -n /proc
|
| 41 |
eend $?
|
| 42 |
devfs="yes"
|
| 43 |
for copt in `cat /proc/cmdline`
|
| 44 |
do
|
| 45 |
if [ "${copt%=*}" = "gentoo" ]
|
| 46 |
then
|
| 47 |
parms=${copt##*=}
|
| 48 |
#parse gentoo option
|
| 49 |
if [ "${parms/nodevfs//}" != "${parms}" ]
|
| 50 |
then
|
| 51 |
devfs="no"
|
| 52 |
fi
|
| 53 |
fi
|
| 54 |
done
|
| 55 |
|
| 56 |
#with the new way, /dev can be mounted by the kernel ...
|
| 57 |
wrongmount=0
|
| 58 |
|
| 59 |
if [ "$devfs" = "yes" ] && [ ! -e /dev/.devfsd ]
|
| 60 |
then
|
| 61 |
ebegin "Mounting devfs at /dev"; try mount -n -t devfs none /dev; eend
|
| 62 |
fi
|
| 63 |
|
| 64 |
#mount shm and do dep scan
|
| 65 |
mountshm
|
| 66 |
|
| 67 |
#in theory /dev/shm/.init should not exist if the system had not
|
| 68 |
#executed the boot runlevel. if tmpfs support is not enabled in the
|
| 69 |
#kernel, things will get pretty broken anyhow, so we wont worry about
|
| 70 |
#this for now. (we need to check for this before running depscan.sh...)
|
| 71 |
[ ! -d /dev/shm/.init.d ] && export BOOT="yes"
|
| 72 |
|
| 73 |
/etc/init.d/depscan.sh
|
| 74 |
|
| 75 |
if [ "$devfs" = "yes" ] && [ -e /dev/.devfsd ]
|
| 76 |
then
|
| 77 |
ebegin "Starting devfsd"; /sbin/devfsd /dev >/dev/null 2>&1; eend $?
|
| 78 |
fi
|
| 79 |
|
| 80 |
#swap needs to be activated *after* devfs has been mounted and *after*
|
| 81 |
#devfsd has been started, so that the fstab can be properly parsed
|
| 82 |
|
| 83 |
ebegin "Activating swap"
|
| 84 |
swapon -a
|
| 85 |
eend
|
| 86 |
|
| 87 |
#Now that swap has been activated, we can calculate a reasonable size limit
|
| 88 |
#for /dev/shm so that it doesn't exhaust VM if filled.
|
| 89 |
|
| 90 |
#set the console loglevel to 1, as we want a cleaner boot
|
| 91 |
#the logger should anyhow dump the ring-0 buffer at start to the
|
| 92 |
#logs, and that with dmesg can be used to check for problems
|
| 93 |
/bin/dmesg -n 1
|
| 94 |
|
| 95 |
exec /sbin/init.system $*
|
| 96 |
#rename to init.system
|