--- trunk/magellan-initscripts/etc/rc.d/init.d/rc 2006/10/31 10:50:22 395 +++ trunk/magellan-initscripts/etc/rc.d/init.d/rc 2007/08/17 22:07:29 514 @@ -1,5 +1,5 @@ #!/bin/bash -# $Header: /home/cvsd/magellan-cvs/magellan-src/magellan-initscripts/etc/rc.d/init.d/rc,v 1.11 2006-10-31 10:50:22 niro Exp $ +# $Header: /home/cvsd/magellan-cvs/magellan-src/magellan-initscripts/etc/rc.d/init.d/rc,v 1.15 2007-08-17 22:07:29 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,6 +164,9 @@ # 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 @@ -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