chiark / gitweb /
[PATCH] 014_bk mark
[elogind.git] / etc / init.d / udev
index c540057d21ae82b925ed0d56286bc8f354150304..364a9aa5f714c5d8f802819466f795cc6767f145 100644 (file)
@@ -7,24 +7,13 @@
 
 . /etc/rc.d/init.d/functions
 
-udev_dir=/udev
+. /etc/udev/udev.conf
+
 sysfs_dir=/sys
 bin=/sbin/udev
 
-case "$1" in
-  start)
-       if [ ! -d $udev_dir ]; then
-               mkdir $udev_dir
-       fi
-       if [ ! -d $sysfs_dir ]; then
-               exit 1
-       fi
-       # propogate /udev from /sys - we only need this while we do not
-       # have initramfs and an early user-space with which to do early
-       # device bring up
-       action "Creating initial udev device nodes: " /bin/true
-       export ACTION=add
-       # add block devices and their partitions
+run_udev () {
+       # handle block devices and their partitions
        for i in ${sysfs_dir}/block/*; do
                # add each drive
                export DEVPATH=${i#${sysfs_dir}}
@@ -49,17 +38,32 @@ case "$1" in
                        fi
                done
        done
+}
+
+
+case "$1" in
+  start)
+       if [ ! -d $sysfs_dir ]; then
+               exit 1
+       fi
+       if [ ! -d $udev_root ]; then
+               mkdir $udev_root
+       fi
+       # propogate /udev from /sys - we only need this while we do not
+       # have initramfs and an early user-space with which to do early
+       # device bring up
+       action "Creating initial udev device nodes: " /bin/true
+       export ACTION=add
+       run_udev 
        ;;
   stop)
        # be careful
        action "Removing udev device nodes: " /bin/true
-       if [ $udev_dir -a "$udev_dir" != "/" ]; then
-               # clear out /udev
-               rm -rf ${udev_dir}/*
-       fi
+       export ACTION=remove
+       run_udev 
        ;;
   status)
-       if [ -d $udev_dir ]; then
+       if [ -d $udev_root ]; then
                echo "the udev device node directory exists"
        else
                echo "the udev device node directory does not exist"