3 # Author: Rolf Eike Beer <eike-hotplug@sf-tec.de>
4 # derived from original RedHat udev init script
5 # based on the SuSE 9.0 template (c) 1995-2002 SuSE Linux AG
8 # and its symbolic link
11 # System startup script for udev
13 # LSB compatible service control script; see http://www.linuxbase.org/spec/
19 # Default-Start: 1 2 3 5
21 # Short-Description: manage user-space device nodes in /udev
22 # Description: Start udev to create the device files for all
23 # devices already present in system when script is
24 # called. All other devices files will be automatically
25 # created when udev is called via /sbin/hotplug.
26 # Requires at least a kernel 2.6 to work properly.
29 # Note on script names:
30 # http://www.linuxbase.org/spec/refspecs/LSB_1.2.0/gLSB/scrptnames.html
31 # A registry has been set up to manage the init script namespace.
32 # http://www.lanana.org/
33 # Please use the names already registered or register one or use a
37 # Check for missing binaries (stale symlinks should not happen)
39 test -x $UDEV_BIN || exit 5
41 # Check for existence of needed config file and read it
42 UDEV_CONFIG=/etc/udev/udev.conf
43 test -r $UDEV_CONFIG || exit 6
46 # Directory where sysfs is mounted
49 # Source LSB init functions
50 . /lib/lsb/init-functions
53 # handle block devices and their partitions
54 for i in ${SYSFS_DIR}/block/*; do
56 export DEVPATH=${i#${SYSFS_DIR}}
59 # add each partition, on each device
61 if [ -f $j/dev ]; then
62 export DEVPATH=${j#${SYSFS_DIR}}
67 # all other device classes
68 for i in ${SYSFS_DIR}/class/*; do
70 if [ -f $j/dev ]; then
71 export DEVPATH=${j#${SYSFS_DIR}}
72 CLASS=`echo ${i#${SYSFS_DIR}} | \
73 cut --delimiter='/' --fields=3-`
82 if [ ! -d $SYSFS_DIR ]; then
83 log_failure_msg "${0}: SYSFS_DIR \"$SYSFS_DIR\" not found"
86 if [ ! -d $udev_root ]; then
87 mkdir $udev_root || exit 4
89 # propogate /udev from /sys - we only need this while we do not
90 # have initramfs and an early user-space with which to do early
92 echo -n "Creating initial udev device nodes: "
99 echo -n "Removing udev device nodes: "
102 rm -f $udev_db || exit 1
103 rmdir $udev_root || exit 1
113 echo -n "Reload udev "
121 echo -n "Checking for udev root directory: "
122 if [ -d $udev_root ]; then
123 log_success_msg found
125 log_warning_msg "not found"
130 echo "Usage: $0 {start|stop|status|restart|force-reload|reload}"