source: udev/udev @ de4db44

clfs-1.2clfs-2.1clfs-3.0.0-systemdclfs-3.0.0-sysvinitsystemdsysvinit
Last change on this file since de4db44 was de4db44, checked in by Jim Gifford <clfs@…>, 18 years ago

r1124@server (orig r1122): jim | 2006-02-01 12:17:00 -0800

r1160@server: jim | 2006-02-01 11:34:59 -0800
Remove uneeded mounting of pts


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