source: udev/udev@ 67335ba

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 67335ba was 1f7827a2, checked in by Jim Gifford <clfs@…>, 19 years ago

r1012@server (orig r1010): jim | 2006-01-06 10:33:15 -0800

r1291@server: jim | 2006-01-06 10:31:33 -0800
Updates based on Alex's findings. Thank You Alex


  • Property mode set to 100755
File size: 2.6 KB
Line 
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
22trigger_device_events() {
23 # generate events with the sysfs trigger
24 list=$(echo /sys/bus/*/devices/*/uevent)
25 list="$list $(echo /sys/class/*/*/uevent)"
26 list="$list $(echo /sys/block/*/uevent /sys/block/*/*/uevent)"
27 for i in $list; do
28 case "$i" in
29 */device/uevent|*\**)
30 # skip followed device symlinks
31 continue
32 ;;
33
34 */class/mem/*|*/class/tty/*)
35 first="$first $i"
36 ;;
37
38 */block/md*)
39 last="$last $i"
40 ;;
41
42 */*)
43 default="$default $i"
44 ;;
45 esac
46 done
47
48 # trigger the sorted events
49 for i in $first $default $last; do
50 echo "add" > "$i"
51 done
52}
53
54case "$1" in
55 start)
56 boot_mesg "Creating /dev in tmpfs..."
57 mount -n -t tmpfs tmpfs /dev -o mode=755
58 evaluate_retval
59
60 boot_mesg "Copying static entries..."
61 cp -ar /lib/udev/devices/* /dev
62 evaluate_retval
63
64 # disable hotplug helper, udevd listens to netlink
65 if [ `cat /proc/sys/kernel/hotplug` ] ; then
66 echo "" > /proc/sys/kernel/hotplug
67 fi
68
69 # start udevd
70 boot_mesg "Starting udevd..."
71 /sbin/udevd --daemon
72 evaluate_retval
73
74 # start coldplugging
75 boot_mesg "Performing Coldplugging..."
76
77 # unlikely, but we may be faster than the first event
78 mkdir -p /dev/.udev/queue
79
80 # configure all devices
81 trigger_device_events
82
83 # until we know how to do better, just wait for _all_ events to finish
84 loop=300
85 while test -d /dev/.udev/queue; do
86 sleep 0.1;
87 test "$loop" -gt 0 || break
88 loop=$(($loop - 1))
89 done
90
91 echo_ok
92 ;;
93
94 stop)
95 boot_mesg "Stopping udevd..."
96 echo "/sbin/hotplug" > /proc/sys/kernel/hotplug
97 killproc /sbin/udevd
98 ;;
99
100 restart)
101 boot_mesg "Restarting udevd..."
102 killproc /sbin/udevd
103 loadproc /sbin/udevd --daemon
104 evaluate_retval
105 ;;
106
107 status)
108 statusproc /sbin/udevd
109 ;;
110
111 reload)
112 boot_mesg "Reloading udev rules..."
113 udevcontrol reload_rules
114 cp --preserve=all --recursive --update /lib/udev/devices/* /dev
115 evaluate_retval
116 ;;
117
118 force-reload)
119 boot_mesg "Updating all available device nodes in /dev..."
120 udevcontrol reload_rules
121 rm -rf /dev/.udev /dev/disk
122 cp --preserve=all --recursive --update /lib/udev/devices/* /dev
123 trigger_device_events
124 evaluate_retval
125 ;;
126
127 *)
128 echo "Usage: $0 {start|stop|restart|status|reload|force-reload}"
129 exit 1
130 ;;
131esac
Note: See TracBrowser for help on using the repository browser.