3 # udev init script to setup /udev
5 # chkconfig: 2345 20 80
6 # description: manage user-space device nodes in /udev
8 . /etc/rc.d/init.d/functions
18 # handle block devices and their partitions
19 for i in ${sysfs_dir}/block/*; do
21 export DEVPATH=${i#${sysfs_dir}}
24 # add each partition, on each device
26 if [ -f $j/dev ]; then
27 export DEVPATH=${j#${sysfs_dir}}
32 # all other device classes
33 for i in ${sysfs_dir}/class/*; do
35 if [ -f $j/dev ]; then
36 export DEVPATH=${j#${sysfs_dir}}
37 CLASS=`echo ${i#${sysfs_dir}} | \
38 cut --delimiter='/' --fields=3-`
47 # there are a few things that sysfs does not export for us.
48 # these things go here (and remember to remove them in
49 # remove_extra_nodes()
51 # Thanks to Gentoo for the initial list of these.
52 ln -snf /proc/self/fd $udev_root/fd
53 ln -snf /proc/self/fd/0 $udev_root/stdin
54 ln -snf /proc/self/fd/1 $udev_root/stdout
55 ln -snf /proc/self/fd/2 $udev_root/stderr
56 ln -snf /proc/kcore $udev_root/core
57 #ln -snf /proc/asound/oss/sndstat $udev_root/sndstat
60 remove_extra_nodes () {
61 # get rid of the extra nodes created in make_extra_nodes()
67 #rm $udev_root/sndstat
72 # don't use udev if sysfs is not mounted.
73 if [ ! -d $sysfs_dir/block ]; then
76 if [ ! -d $udev_root ]; then
80 # remove the database if it is there as we always want to start fresh
81 if [ -f $udev_root/.udev.tdb ]; then
82 rm -f $udev_root/.udev.tdb
85 # propogate /udev from /sys - we only need this while we do not
86 # have initramfs and an early user-space with which to do early
89 echo -n $"Creating initial udev device nodes:"
94 touch /var/lock/subsys/udev
98 echo -n $"Removing udev device nodes: "
104 rm -f /var/lock/subsys/udev
107 if [ -f /var/lock/subsys/udev ]; then
108 echo $"$prog has run"
111 echo $"$prog is stopped"
122 echo "Usage: $0 {start|stop|status|restart}"