#!/bin/sh -e PATH=/sbin:/bin:/usr/sbin:/usr/bin UDEV=/sbin/udev [ -x $UDEV -a -e /proc/sys/kernel/hotplug ] || exit 0 [ -c /dev/.devfsd ] && exit 0 case "$(uname -r)" in 2.[01234].*) echo "udev requires a 2.6.x kernel, not started." exit 0 ;; esac mount_sysfs() { [ -d /sys ] || mkdir /sys [ -d /sys/class ] || mount -t sysfs sysfs: /sys } synthesize_events() { echo -n "Creating initial udev device nodes..." export ACTION=add # add tty devices for i in /sys/class/tty/* /sys/class/video4linux/*; do export DEVPATH=${i#/sys} # echo -n " $DEVPATH" $UDEV tty done # add block devices and their partitions for i in /sys/block/*; do export DEVPATH=${i#/sys} # echo -n " $DEVPATH" $UDEV block for j in $i/*; do [ -f "$j/dev" ] || continue export DEVPATH=${j#/sys} # echo -n " $DEVPATH" $UDEV block done done echo "done." return 0 } case "$1" in start|restart|force-reload) [ -d /udev ] || mkdir /udev mount_sysfs synthesize_events if [ "$(cat /proc/sys/kernel/hotplug)" = "/sbin/hotplug" ]; then : else echo $UDEV > /proc/sys/kernel/hotplug echo "/dev management daemon (udev) enabled." fi ;; stop) if [ "$(cat /proc/sys/kernel/hotplug)" = "$UDEV" ]; then echo /bin/true > /proc/sys/kernel/hotplug echo "/dev management daemon (udev) disabled." fi ;; *) echo "Usage: /etc/init.d/udev {start|stop|restart|force-reload}" exit 1 ;; esac exit 0