--- /sbin/functions.sh.orig 2003-07-07 15:15:51.000000000 -0400 +++ /sbin/functions.sh 2003-07-11 15:39:36.000000000 -0400 @@ -26,7 +26,6 @@ svcmount="no" svcfstype="tmpfs" svcsize=1024 -shmdir="/mnt/.shm" # Different types of dependencies deptypes="need use" @@ -121,6 +120,32 @@ BRACKET=$'\e[34;01m' fi +if [ -e /proc/cmdline ] +then + for copt in `cat /proc/cmdline` + do + if [ "${copt%=*}" = "softlevel" ] + then + forcedlevel="${copt##*=}" + CONFSUFFIX=".${forcedlevel}" + elif [ "${copt%=*}" = "bootlevel" ] + then + BOOTLEVEL="${copt##*=}" + fi + done + + if [ -z "${BOOTLEVEL}" -o ! -d "/etc/runlevels/${BOOTLEVEL}" ] + then + if [ -d "/etc/runlevels/boot${CONFSUFFIX}" -o \ + -L "/etc/runlevels/boot${CONFSUFFIX}" ] + then + BOOTLEVEL="boot${CONFSUFFIX}" + else + BOOTLEVEL="boot" + fi + fi +fi + # void esyslog(char* priority, char* tag, char* message) # # use the system logger to log a message @@ -312,87 +337,6 @@ return "${retval}" } -# int checkserver(void) -# -# Return 0 (no error) if this script is executed -# onto the server, one otherwise. -# See the boot section of /sbin/rc for more details. -# -checkserver() { - # Only do check if 'gentoo=adelie' is given as kernel param - if get_bootparam "adelie" - then - [ "$(< "${svcdir}/hostname")" = "(none)" ] || return 1 - fi - - return 0 -} - -# void init_node(void) -# -# Initialize an Adelie node. -# -init_node() { - local DIR= - local SUBDIR= - local EMPTYDIR= - - ebegin "Importing local userspace on node" - - try mount -t tmpfs none "${shmdir}" - - for DIR in /etc /var /root - do - - 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 $(< "${shmdir}/${DIR}.lst") - do - mkdir -p "${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 $(< "/etc/conf.d/exclude/${DIR}") - do - mkdir -p "${shmdir}/${EMPTYDIR}" - chmod --reference="${SUBDIR}" "${shmdir}/${SUBDIR}" - done - fi - - umount -n "${DIR}" > /dev/null - mount -n -o bind "${shmdir}/${DIR}" "${DIR}" - done - - mkdir -p "${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 - - return 0 -} - # char *KV_major(string) # # Return the Major version part of given kernel version. @@ -599,5 +543,17 @@ set +a +# char *add_suffix(char * configfile) +# +# Returns a config file name with the softlevel suffix +# appended to it. For use with multi-config services. +add_suffix () { + if [ -e ${1}${CONFSUFFIX} ] + then + echo ${1}${CONFSUFFIX} + else + echo ${1} + fi +} # vim:ts=4