1 | #!/bin/bash
|
---|
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 | case "$1" in
|
---|
23 | start)
|
---|
24 | boot_mesg "Creating /dev in tmpfs..."
|
---|
25 | mount -n -t tmpfs -o mode=0755 udev /dev
|
---|
26 | evaluate_retval
|
---|
27 |
|
---|
28 | boot_mesg "Copying static entries..."
|
---|
29 | cp --preserve=all --recursive --remove-destination @LIBDIR@/udev/devices/* /dev
|
---|
30 | evaluate_retval
|
---|
31 |
|
---|
32 | boot_mesg "Setting Permissons on /dev/shm..."
|
---|
33 | chmod 1777 /dev/shm
|
---|
34 | evaluate_retval
|
---|
35 |
|
---|
36 | echo "" > /sys/kernel/uevent_helper
|
---|
37 |
|
---|
38 | # start udevd
|
---|
39 | boot_mesg "Starting udevd..."
|
---|
40 | /sbin/udevd --daemon
|
---|
41 | evaluate_retval
|
---|
42 |
|
---|
43 | # start coldplugging
|
---|
44 | boot_mesg "Performing Coldplugging..."
|
---|
45 |
|
---|
46 | # unlikely, but we may be faster than the first event
|
---|
47 | mkdir -p /dev/.udev/queue
|
---|
48 |
|
---|
49 | # configure all devices
|
---|
50 | /sbin/udevadm trigger
|
---|
51 |
|
---|
52 | # this replaces the old loop, exits after all devices are done
|
---|
53 | /sbin/udevadm settle
|
---|
54 |
|
---|
55 | echo_ok
|
---|
56 | ;;
|
---|
57 |
|
---|
58 | stop)
|
---|
59 | boot_mesg "Stopping udevd..."
|
---|
60 | killproc /sbin/udevd
|
---|
61 | ;;
|
---|
62 |
|
---|
63 | restart)
|
---|
64 | boot_mesg "Restarting udevd..."
|
---|
65 | killproc /sbin/udevd
|
---|
66 | loadproc /sbin/udevd --daemon
|
---|
67 | evaluate_retval
|
---|
68 | ;;
|
---|
69 |
|
---|
70 | status)
|
---|
71 | statusproc /sbin/udevd
|
---|
72 | ;;
|
---|
73 |
|
---|
74 | reload)
|
---|
75 | boot_mesg "Reloading udev rules..."
|
---|
76 | udevadm control reload_rules
|
---|
77 | cp --preserve=all --recursive --update @LIBDIR@/udev/devices/* /dev
|
---|
78 | evaluate_retval
|
---|
79 | ;;
|
---|
80 |
|
---|
81 | force-reload)
|
---|
82 | boot_mesg "Updating all available device nodes in /dev..."
|
---|
83 | udevadm control reload_rules
|
---|
84 | rm -rf /dev/.udev /dev/disk
|
---|
85 | cp --preserve=all --recursive --update @LIBDIR@/udev/devices/* /dev
|
---|
86 | /sbin/udevadm trigger
|
---|
87 | /sbin/udevadm settle
|
---|
88 | evaluate_retval
|
---|
89 | ;;
|
---|
90 |
|
---|
91 | *)
|
---|
92 | echo "Usage: $0 {start|stop|restart|status|reload|force-reload}"
|
---|
93 | exit 1
|
---|
94 | ;;
|
---|
95 | esac
|
---|