source: udev/udev@ 8b22376

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

r1005@server (orig r1003): jim | 2006-01-05 08:50:47 -0800

r1277@server: jim | 2006-01-05 08:50:21 -0800
Adding boot_mesg to new additions to udev script


  • Property mode set to 100755
File size: 2.7 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
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 boot_mesg "Executing udevstart..."
65 udevstart
66 evaluate_retval
67
68 # disable hotplug helper, udevd listens to netlink
69 echo "" > /proc/sys/kernel/hotplug
70
71 # start udevd
72 boot_mesg "Starting udevd..."
73 loadproc /sbin/udevd --daemon
74
75 # cleanup some stuff
76 rm -f /var/run/sysconfig/network
77 rm -rf /events/*
78
79 # start coldplugging
80 boot_mesg "Performing Coldplugging..."
81
82 # unlikely, but we may be faster than the first event
83 mkdir -p /dev/.udev/queue
84
85 # configure all devices
86 trigger_device_events
87
88 # until we know how to do better, just wait for _all_ events to finish
89 loop=300
90 while test -d /dev/.udev/queue; do
91 sleep 0.1;
92 test "$loop" -gt 0 || break
93 loop=$(($loop - 1))
94 done
95
96 echo_ok
97 ;;
98
99 stop)
100 boot_mesg "Stopping udevd..."
101 echo "/sbin/hotplug" > /proc/sys/kernel/hotplug
102 killproc /sbin/udevd
103 ;;
104
105 restart)
106 boot_mesg "Restarting udevd..."
107 killproc /sbin/udevd
108 loadproc /sbin/udevd --daemon
109 evaluate_retval
110 ;;
111
112 status)
113 statusproc /sbin/udevd
114 ;;
115
116 reload)
117 boot_mesg "Reloading udev rules..."
118 udevcontrol reload_rules
119 cp --preserve=all --recursive --update /lib/udev/devices/* /dev
120 evaluate_retval
121 ;;
122
123 force-reload)
124 boot_mesg "Updating all available device nodes in /dev..."
125 udevcontrol reload_rules
126 rm -rf /dev/.udev /dev/disk
127 cp --preserve=all --recursive --update /lib/udev/devices/* /dev
128 trigger_device_events
129 evaluate_retval
130 ;;
131
132 *)
133 echo "Usage: $0 {start|stop|restart|status|reload|force-reload}"
134 exit 1
135 ;;
136esac
Note: See TracBrowser for help on using the repository browser.