--- trunk/magellan-initscripts/etc/rc.d/init.d/rc 2006/10/31 09:10:45 394 +++ trunk/magellan-initscripts/etc/rc.d/init.d/rc 2007/09/01 19:17:36 525 @@ -1,5 +1,5 @@ #!/bin/bash -# $Header: /home/cvsd/magellan-cvs/magellan-src/magellan-initscripts/etc/rc.d/init.d/rc,v 1.10 2006-10-31 09:10:45 niro Exp $ +# $Header: /home/cvsd/magellan-cvs/magellan-src/magellan-initscripts/etc/rc.d/init.d/rc,v 1.17 2007-09-01 19:13:18 niro Exp $ source /etc/sysconfig/rc source $rc_functions @@ -21,6 +21,11 @@ version=${version##0} # Older udev's will print nothing [[ -z ${version} ]] && version=0 + elif [[ -x /sbin/udevd ]] + then + version=$(/sbin/udevd --version) + version=${version##0} + [[ -z ${version} ]] && version=0 fi echo "${version}" @@ -30,11 +35,14 @@ { local opts + # tell modprobe.sh to be verbose to $CONSOLE + echo CONSOLE=${CONSOLE} > /dev/.udev_populate + # populate /dev with devices already found by the kernel if [ "$(kernel_version | sed 's:\.::g' | cut -d_ -f1)" -gt "2614" ] then echo -e ${COLOREDSTAR}" Populating /dev with existing devices through uevents ..." - [[ $(udev_version) -ge "96" ]] && opts="--attr-match=dev" + [[ $(udev_version) -ge "96" ]] && [[ ${RC_COLDPLUG} != yes ]] && opts="--attr-match=dev" /sbin/udevtrigger ${opts} evaluate_retval else @@ -48,6 +56,7 @@ /sbin/udevsettle --timeout=60 evaluate_retval + rm -f /dev/.udev_populate return 0 } @@ -56,12 +65,16 @@ # seed /dev with some things that we know we need echo -e ${COLOREDSTAR}" Seeding /dev with needed nodes ..." ( + [ ! -c /dev/console ] && mknod /dev/console c 5 1 + [ ! -c /dev/tty1 ] && mknod /dev/tty1 c 4 1 + [ ! -c /dev/null ] && mknod /dev/null c 1 3 + # copy over any persistant things if [[ -d /lib/udev/devices ]] then - cp --preserve=all --recursive --update /lib/udev/devices/* /dev + cp --preserve=all --recursive --update /lib/udev/devices/* /dev 2>/dev/null fi - + # not provided by sysfs but needed ln -snf /proc/self/fd /dev/fd ln -snf fd/0 /dev/stdin @@ -83,7 +96,7 @@ then echo echo -e "${COLGREEN}Starting ${COLBLUE}MAGELLAN (v${MAGEVER}) ${COLGREEN}Linux${COLDEFAULT}" - echo -e "Copyright 2001-2006 Niels Rogalla; http://magellan-linux.net" + echo -e "Copyright 2001-2007 Niels Rogalla; http://magellan-linux.net" echo # mount proc filesystem, needed for bootsplash; @@ -151,13 +164,16 @@ # load udev only with a 2.6 kernel if [[ $(kernel_major_version) = 2.6 ]] && [[ ${RC_USED_DEV} = udev ]] then + # check if /dev/console exists outside tmpfs + [ -c /dev/console ] ; need_redirect=$? + # create a ramdisk for populating udev echo -e ${COLOREDSTAR}"Mounting udev at /dev ..." # many video drivers needed exec access fstype=ramfs # tmpfs was suggested by Greg Kroah-Hartman - [[ kernel_supports_fs tmpfs ]] && fstype=tmpfs - mount -n -t ${fstype} udev /dev -o exec,nosuid,mode=0755 + kernel_supports_fs tmpfs && fstype=tmpfs + mount -n -t ${fstype} udev /dev -o exec,nosuid,mode=0755,size=10M evaluate_retval # if a device tarball exists load it and if it is activated @@ -190,9 +206,16 @@ fi echo -e ${COLOREDSTAR}" Starting udevd daemon ..." - /sbin/udevd --daemon + if [ ${need_redirect} -eq 1 ] + then + # we need to open fds 0 1 2 + /sbin/udevd --daemon /dev/console 2>/dev/console + else + /sbin/udevd --daemon + fi evaluate_retval + /lib/udev/write_root_link_rule populate_udev # create nodes that udev can't @@ -243,6 +266,14 @@ fi fi + ## load usbfs ## + if kernel_supports_fs usbfs + then + echo -e ${COLOREDSTAR}"Mounting usbfs at /proc/bus/usb ..." + mount -n -t usbfs usbfs /proc/bus/usb + evaluate_retval + fi + ### services state dir ### echo -e ${COLOREDSTAR}"Mounting tmpfs at ${svcdir} ..." mount -n -t tmpfs tmpfs "${svcdir}" -o rw,mode=0644,size="${svcsize}"k