--- /sbin/rc.orig 2003-05-27 03:06:15.000000000 -0400 +++ /sbin/rc 2003-06-20 05:41:49.000000000 -0400 @@ -51,6 +51,29 @@ try mount -n /proc; \ eend $? + # We set the forced softlevel from the kernel command line + # It needs to be run right after proc is mounted for the + # boot runlevel + for copt in `cat /proc/cmdline` + do + if [ "${copt%=*}" = "softlevel" ] + then + CONFSUFFIX=".${copt##*=}" + elif [ "${copt%=*}" = "bootlevel" ] + then + BOOTLEVEL="${copt##*=}" + fi + done + + if [ -d /etc/runlevels/boot${CONFSUFFIX} \ + -o -L /etc/runlevels/boot${CONFSUFFIX} \ + -a ! "${BOOTLEVEL}" ] + then + BOOTLEVEL="boot${CONFSUFFIX}" + else + BOOTLEVEL="boot" + fi + # check if the user disabled devfs devfs="yes" get_bootparam "nodevfs" @@ -154,77 +177,14 @@ /sbin/depscan.sh - # Saving the kernel attributed hostname to a file for future - # initialisation selection: see /etc/init.d/switch. - get_bootparam "adelie" && cat /proc/sys/kernel/hostname > ${svcdir}/hostname - - get_bootparam "adelie" && einfo "Server/Node low-level initialisation..." - if checkserver - then - get_bootparam "adelie" && einfo "Server detected." - - # swap needs to be activated *after* devfs has been mounted and *after* - # devfsd has been started, so that the fstab can be properly parsed - # and only if the server is initialized - ebegin "Activating swap" - /sbin/swapon -a &>/dev/null - eend 0 - else - # - # Low-level Node Initialisation - # - einfo "Node detected." - ebegin "Importing local userspace on node" - - try mount -t tmpfs none ${shmdir} - - for DIR in /etc /var /root; - do + # swap needs to be activated *after* devfs has been mounted and *after* + # devfsd has been started, so that the fstab can be properly parsed + # and only if the server is initialized + ebegin "Activating swap" + /sbin/swapon -a &>/dev/null + eend 0 - if grep -q -v "^${DIR}[[:space:]]" /etc/exports - then - mount -o nolock -n server:${DIR} ${DIR} - fi - - if [ -e /etc/conf.d/exclude/${DIR} ] - then - find ${DIR} -type d | grep -v -f /etc/conf.d/exclude/${DIR} > ${shmdir}/${DIR}.lst - else - find ${DIR} -type d > ${shmdir}/${DIR}.lst - fi - - for SUBDIR in $(cat ${shmdir}/${DIR}.lst); - do - mkdir ${shmdir}/${SUBDIR} - chmod --reference=${SUBDIR} ${shmdir}/${SUBDIR} - cp -dp ${SUBDIR}/* ${shmdir}/${SUBDIR} &>/dev/null - done - - if [ -e /etc/conf.d/exclude/${DIR} ] - then - for EMPTYDIR in $(cat /etc/conf.d/exclude/${DIR}); - do - mkdir ${shmdir}/${EMPTYDIR} - chmod --reference=${SUBDIR} ${shmdir}/${SUBDIR} - done - fi - - umount -n ${DIR} > /dev/null - mount -n -o bind ${shmdir}/${DIR} ${DIR} - done - - mkdir ${shmdir}/tmp - chmod 0777 ${shmdir}/tmp - mount -n -o bind ${shmdir}/tmp /tmp - - cat /proc/mounts > /etc/mtab - - cp -f /etc/inittab.node /etc/inittab - [ -e /etc/fstab.node ] && cp -f /etc/fstab.node /etc/fstab - killall -1 init - - eend 0 - fi + argv1="${BOOTLEVEL}" # set the console loglevel to 1 for a cleaner boot # the logger should anyhow dump the ring-0 buffer at start to the @@ -245,10 +205,18 @@ then export SOFTLEVEL="$(cat ${svcdir}/softlevel)" else - export SOFTLEVEL="boot" + export SOFTLEVEL="${BOOTLEVEL}" fi else - export SOFTLEVEL="${argv1}" + [ -f ${svcdir}/softlevel ] && \ + LAST_SOFTLEVEL="$(cat ${svcdir}/softlevel)" + if [ "${LAST_SOFTLEVEL:0:4}" = "boot" -a "${argv1}" = "default" \ + -a "${forcedlevel}" ] + then + export SOFTLEVEL="${forcedlevel}" + else + export SOFTLEVEL="${argv1}" + fi fi if [ ! -f ${svcdir}/softlevel ] @@ -273,11 +241,11 @@ exit 1 else myscripts="" - if [ "${SOFTLEVEL}" != "boot" ] + if [ "${SOFTLEVEL}" != "${BOOTLEVEL}" ] then # normal runlevels *include* boot scripts mylevels="$(dolisting /etc/runlevels/${SOFTLEVEL}/)" - mylevels="${mylevels} $(dolisting /etc/runlevels/boot/)" + mylevels="${mylevels} $(dolisting /etc/runlevels/${BOOTLEVEL}/)" else # non-normal runlevels don't include boot scripts as default mylevels="$(dolisting /etc/runlevels/${SOFTLEVEL}/)"