source: udev/boot.udev@ 4f14c0d

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

r861@server (orig r859): jim | 2005-12-06 22:41:11 -0800

r994@server: jim | 2005-12-06 22:39:42 -0800
Updates from 077 OpenSuse Package


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