--- trunk/magellan-initscripts/etc/rc.d/init.d/rc 2006/05/29 21:25:45 376 +++ trunk/magellan-initscripts/etc/rc.d/init.d/rc 2006/10/31 09:10:45 394 @@ -1,5 +1,5 @@ #!/bin/bash -# $Header: /home/cvsd/magellan-cvs/magellan-src/magellan-initscripts/etc/rc.d/init.d/rc,v 1.9 2006-05-29 21:25:45 niro Exp $ +# $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 $ source /etc/sysconfig/rc source $rc_functions @@ -26,55 +26,16 @@ echo "${version}" } -# this works only for 2.6.15 kernels and greater -trigger_events() -{ - local list="" - local i - local first - local last - local default - - # if you want real hotplug (with all modules being loaded for all - # devices in the system), uncomment out the next line. - #list="$list $(echo /sys/bus/*/devices/*/uevent)" - list="${list} $(echo /sys/class/*/*/uevent)" - list="${list} $(echo /sys/block/*/uevent /sys/block/*/*/uevent)" - for i in ${list} - do - case "${i}" in - */device/uevent) - # skip followed device symlinks - continue - ;; - */class/mem/*|*/class/tty/*) - first="${first} ${i}" - ;; - */block/md*) - last="${last} ${i}" - ;; - */*) - default="${default} ${i}" - ;; - esac - done - - # trigger the sorted events - for i in ${first} ${default} ${last} - do - echo "add" > "${i}" - done -} - populate_udev() { - local loop + local opts # 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 ..." - trigger_events + [[ $(udev_version) -ge "96" ]] && opts="--attr-match=dev" + /sbin/udevtrigger ${opts} evaluate_retval else echo -e ${COLOREDSTAR}" Populating /dev with existing devices with udevstart ..." @@ -83,15 +44,8 @@ fi # loop until everything is finished - # there's gotta be a better way... echo -e ${COLOREDSTAR}" Letting udev process events ..." - loop=0 - while test -d /dev/.udev/queue - do - sleep 0.1; - test "${loop}" -gt 300 && break - loop=$((${loop} + 1)) - done + /sbin/udevsettle --timeout=60 evaluate_retval return 0 @@ -103,7 +57,10 @@ echo -e ${COLOREDSTAR}" Seeding /dev with needed nodes ..." ( # copy over any persistant things - cp --preserve=all --recursive --update /lib/udev/devices/* /dev + if [[ -d /lib/udev/devices ]] + then + cp --preserve=all --recursive --update /lib/udev/devices/* /dev + fi # not provided by sysfs but needed ln -snf /proc/self/fd /dev/fd @@ -196,9 +153,11 @@ then # create a ramdisk for populating udev echo -e ${COLOREDSTAR}"Mounting udev at /dev ..." - # tmpfs was suggested by Greg Kroah-Hartman # many video drivers needed exec access - mount -n -t ramfs udev /dev -o exec,nosuid,mode=0755 + 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 evaluate_retval # if a device tarball exists load it and if it is activated @@ -220,19 +179,10 @@ echo -e ${COLOREDSTAR}" Using netlink for hotplug events ..." echo "" > /proc/sys/kernel/hotplug evaluate_retval - elif [[ $(udev_version) -ge "48" ]] - then + else echo -e ${COLOREDSTAR}" Setting /sbin/udevsend as hotplug agent ..." echo "/sbin/udevsend" > /proc/sys/kernel/hotplug evaluate_retval - elif [[ -x /sbin/hotplug ]] - then - echo -e ${COLOREDSTAR}" Using /sbin/hotplug as hotplug agent ..." - print_status success - else - echo -e ${COLOREDSTAR}" Setting /sbin/udev as hotplug agent ..." - echo "/sbin/udev" > /proc/sys/kernel/hotplug - evaluate_retval fi else echo -e ${COLOREDSTAR}${COLYELLOW}" Kernel was not compiled with hotplug support !"