1 | #!/bin/sh
|
---|
2 | ########################################################################
|
---|
3 | # Begin $rc_base/init.d/udev
|
---|
4 | #
|
---|
5 | # Description : Udev Boot Script
|
---|
6 | #
|
---|
7 | # Authors : Based on Open Suse Udev Rules
|
---|
8 | # kay.sievers@suse.de
|
---|
9 | #
|
---|
10 | # Adapted to : Jim Gifford
|
---|
11 | # LFS : Alexander E. Patrakov
|
---|
12 | #
|
---|
13 | # Version : 00.00
|
---|
14 | #
|
---|
15 | # Notes :
|
---|
16 | #
|
---|
17 | ########################################################################
|
---|
18 |
|
---|
19 | . /etc/sysconfig/rc
|
---|
20 | . ${rc_functions}
|
---|
21 |
|
---|
22 | if [ -d "/lib64" ]; then
|
---|
23 | udev_libdir=/lib64
|
---|
24 | else
|
---|
25 | udev_libdir=/lib
|
---|
26 | fi
|
---|
27 |
|
---|
28 | case "$1" in
|
---|
29 | start)
|
---|
30 | boot_mesg "Creating /dev in tmpfs..."
|
---|
31 | mount -n -t tmpfs -o mode=0755 udev /dev
|
---|
32 | evaluate_retval
|
---|
33 |
|
---|
34 | boot_mesg "Copying static entries..."
|
---|
35 | cp --preserve=all --recursive --remove-destination ${udev_libdir}/udev/devices/* /dev
|
---|
36 | evaluate_retval
|
---|
37 |
|
---|
38 | boot_mesg "Setting Permissons on /dev/shm..."
|
---|
39 | chmod 1777 /dev/shm
|
---|
40 | evaluate_retval
|
---|
41 |
|
---|
42 | echo "" > /sys/kernel/uevent_helper
|
---|
43 |
|
---|
44 | # start udevd
|
---|
45 | boot_mesg "Starting udevd..."
|
---|
46 | /sbin/udevd --daemon
|
---|
47 | evaluate_retval
|
---|
48 |
|
---|
49 | # start coldplugging
|
---|
50 | boot_mesg "Performing Coldplugging..."
|
---|
51 |
|
---|
52 | # unlikely, but we may be faster than the first event
|
---|
53 | mkdir -p /dev/.udev/queue
|
---|
54 |
|
---|
55 | # configure all devices
|
---|
56 | /sbin/udevtrigger
|
---|
57 |
|
---|
58 | # this replaces the old loop, exits after all devices are done
|
---|
59 | /sbin/udevsettle
|
---|
60 |
|
---|
61 | echo_ok
|
---|
62 | ;;
|
---|
63 |
|
---|
64 | stop)
|
---|
65 | boot_mesg "Stopping udevd..."
|
---|
66 | killproc /sbin/udevd
|
---|
67 | ;;
|
---|
68 |
|
---|
69 | restart)
|
---|
70 | boot_mesg "Restarting udevd..."
|
---|
71 | killproc /sbin/udevd
|
---|
72 | loadproc /sbin/udevd --daemon
|
---|
73 | evaluate_retval
|
---|
74 | ;;
|
---|
75 |
|
---|
76 | status)
|
---|
77 | statusproc /sbin/udevd
|
---|
78 | ;;
|
---|
79 |
|
---|
80 | reload)
|
---|
81 | boot_mesg "Reloading udev rules..."
|
---|
82 | udevcontrol reload_rules
|
---|
83 | cp --preserve=all --recursive --update ${udev_libdir}/udev/devices/* /dev
|
---|
84 | evaluate_retval
|
---|
85 | ;;
|
---|
86 |
|
---|
87 | force-reload)
|
---|
88 | boot_mesg "Updating all available device nodes in /dev..."
|
---|
89 | udevcontrol reload_rules
|
---|
90 | rm -rf /dev/.udev /dev/disk
|
---|
91 | cp --preserve=all --recursive --update ${udev_libdir}/udev/devices/* /dev
|
---|
92 | /sbin/udevtrigger
|
---|
93 | /sbin/udevsettle
|
---|
94 | evaluate_retval
|
---|
95 | ;;
|
---|
96 |
|
---|
97 | *)
|
---|
98 | echo "Usage: $0 {start|stop|restart|status|reload|force-reload}"
|
---|
99 | exit 1
|
---|
100 | ;;
|
---|
101 | esac
|
---|
102 |
|
---|
103 | unset udev_libdir
|
---|