3 # random init script to setup /udev
5 # chkconfig: 2345 20 80
6 # description: manage user-space device nodes in /udev
8 # 2003-12-23: - some tweaks to run silently on a debian system
9 # 2003-12-30: - manage creation (and deletion) of /proc/self/fd->fd and
10 # fd/[0,1,2]->std[in,out,err] links
11 # - creation and deletion of /proc/kcore->core link
12 # - creation and deletion of /proc/asound/oss/sndstat->sndstat link
24 echo "Assertion $2 failed"
31 # handle block devices and their partitions
32 for i in ${sysfs_dir}/block/*; do
34 export DEVPATH=${i#${sysfs_dir}}
37 # add each partition, on each device
39 if [ -f $j/dev ]; then
40 export DEVPATH=${j#${sysfs_dir}}
45 # all other device classes
46 for i in ${sysfs_dir}/class/*; do
48 if [ -f $j/dev ]; then
49 export DEVPATH=${j#${sysfs_dir}}
50 CLASS=`echo ${i#${sysfs_dir}} | \
51 cut --delimiter='/' --fields=3-`
61 if [ ! -d $udev_dir ]; then
64 if [ ! -d $sysfs_dir ]; then
67 # propogate /udev from /sys - we only need this while we do not
68 # have initramfs and an early user-space with which to do early
70 action "Creating initial udev device nodes: " /bin/true
74 # hack to create stdin node
75 cd $udev_dir && ln -s /proc/self/fd fd
76 cd $udev_dir && ln -s fd/0 stdin
77 cd $udev_dir && ln -s fd/1 stdout
78 cd $udev_dir && ln -s fd/2 stderr
79 cd $udev_dir && ln -s /proc/kcore core
80 cd $udev_dir && ln -s /proc/asound/oss/sndstat sndstat
84 action "Removing udev device nodes: " /bin/true
87 rm -f $udev_dir/sndstat
89 rm -f $udev_dir/stderr
90 rm -f $udev_dir/stdout
95 if [ -d $udev_dir ]; then
96 echo "the udev device node directory exists"
98 echo "the udev device node directory does not exist"
109 echo "Usage: $0 {start|stop|status|restart}"