]>
Commit | Line | Data |
---|---|---|
73d9a908 MT |
1 | #!/bin/sh |
2 | ######################################################################## | |
3 | # Begin $rc_base/init.d/udev | |
4 | # | |
5 | # Description : Udev cold-plugging script | |
6 | # | |
7 | # Authors : Zack Winkles, Alexander E. Patrakov | |
8 | # | |
9 | # Version : 00.02 | |
10 | # | |
11 | # Notes : | |
12 | # | |
13 | ######################################################################## | |
14 | ||
15 | . /etc/sysconfig/rc | |
16 | . ${rc_functions} | |
17 | ||
18 | case "${1}" in | |
19 | start) | |
20 | boot_mesg "Populating /dev with device nodes..." | |
21 | if ! grep -q '[[:space:]]sysfs' /proc/mounts; then | |
22 | echo_failure | |
23 | boot_mesg -n "FAILURE:\n\nUnable to create" ${FAILURE} | |
24 | boot_mesg -n " devices without a SysFS filesystem" | |
25 | boot_mesg -n "\n\nAfter you press Enter, this system" | |
26 | boot_mesg -n " will be halted and powered off." | |
27 | boot_mesg -n "\n\nPress Enter to continue..." ${INFO} | |
28 | boot_mesg "" ${NORMAL} | |
29 | read ENTER | |
30 | /etc/rc.d/init.d/halt stop | |
31 | fi | |
32 | ||
33 | # Mount a temporary file system over /dev, so that any devices | |
34 | # made or removed during this boot don't affect the next one. | |
35 | # The reason we don't write to mtab is because we don't ever | |
36 | # want /dev to be unavailable (such as by `umount -a'). | |
37 | mount -n -t tmpfs tmpfs /dev -o mode=755 | |
38 | if [ ${?} != 0 ]; then | |
39 | echo_failure | |
40 | boot_mesg -n "FAILURE:\n\nCannot mount a tmpfs" ${FAILURE} | |
41 | boot_mesg -n " onto /dev, this system will be halted." | |
42 | boot_mesg -n "\n\nAfter you press Enter, this system" | |
43 | boot_mesg -n " will be halted and powered off." | |
44 | boot_mesg -n "\n\nPress Enter to continue..." ${INFO} | |
45 | boot_mesg "" ${NORMAL} | |
46 | read ENTER | |
47 | /etc/rc.d/init.d/halt stop | |
48 | fi | |
49 | ||
50 | # Udev handles uevents itself, so we don't need to have | |
51 | # the kernel call out to any binary in response to them | |
52 | echo > /proc/sys/kernel/hotplug | |
53 | ||
54 | # Copy static device nodes to /dev | |
55 | cp -a /lib/udev/devices/* /dev | |
56 | ||
57 | # Start the udev daemon to continually watch for, and act on, | |
58 | # uevents | |
59 | /sbin/udevd --daemon | |
60 | ||
61 | # Now traverse /sys in order to "coldplug" devices that have | |
62 | # already been discovered | |
63 | /sbin/udevtrigger | |
64 | ||
65 | # Now wait for udevd to process the uevents we triggered | |
66 | /sbin/udevsettle | |
67 | evaluate_retval | |
68 | ||
69 | ;; | |
70 | ||
71 | *) | |
72 | echo "Usage ${0} {start}" | |
73 | exit 1 | |
74 | ;; | |
75 | esac | |
76 | ||
77 | # End $rc_base/init.d/udev |