chiark / gitweb /
fix cdrom symlink problem in gentoo rules
[elogind.git] / etc / init.d / udev.init.LSB
1 #! /bin/sh
2 #
3 # Author: Rolf Eike Beer <eike-hotplug@sf-tec.de>
4 #   derived from original RedHat udev init script
5 #   based on the SuSE 9.0 template (c) 1995-2002 SuSE Linux AG
6 #
7 # /etc/init.d/udev
8 #   and its symbolic link
9 # /(usr/)sbin/rcudev
10 #
11 # System startup script for udev
12 #
13 # LSB compatible service control script; see http://www.linuxbase.org/spec/
14
15 ### BEGIN INIT INFO
16 # Provides:          udev
17 # Required-Start:    
18 # Required-Stop:     
19 # Default-Start:     1 2 3 5
20 # Default-Stop:      0 6
21 # Short-Description: manage user-space device nodes in /udev
22 # Description:       Start udev to create the device files for all
23 #                    devices already present in system when script is
24 #                    called. All other devices files will be automatically
25 #                    created when udev is called via /sbin/hotplug.
26 #                    Requires at least a kernel 2.6 to work properly.
27 ### END INIT INFO
28
29 # Note on script names:
30 # http://www.linuxbase.org/spec/refspecs/LSB_1.2.0/gLSB/scrptnames.html
31 # A registry has been set up to manage the init script namespace.
32 # http://www.lanana.org/
33 # Please use the names already registered or register one or use a
34 # vendor prefix.
35
36
37 # Check for missing binaries (stale symlinks should not happen)
38 UDEV_BIN=/sbin/udev
39 test -x $UDEV_BIN || exit 5
40
41 # Check for existence of needed config file and read it
42 UDEV_CONFIG=/etc/udev/udev.conf
43 test -r $UDEV_CONFIG || exit 6
44 . $UDEV_CONFIG
45
46 # Directory where sysfs is mounted
47 SYSFS_DIR=/sys
48
49 # Source LSB init functions
50 . /lib/lsb/init-functions
51
52 case "$1" in
53     start)
54         if [ ! -d $SYSFS_DIR ]; then
55                 log_failure_msg "${0}: SYSFS_DIR \"$SYSFS_DIR\" not found"
56                 exit 1
57         fi
58         if [ ! -d $udev_root ]; then
59                 mkdir $udev_root || exit 4
60         fi
61         # propogate /udev from /sys - we only need this while we do not
62         # have initramfs and an early user-space with which to do early
63         # device bring up
64         echo -n "Creating initial udev device nodes: "
65         export ACTION=add
66         udevstart
67         log_success_msg
68         ;;
69     stop)
70         # nothing to do here
71         echo -n "Stopping udev: "
72         log_success_msg
73         ;;
74     restart)
75         $0 stop
76         $0 start
77
78         exit $?
79         ;;
80     force-reload)
81         echo -n "Reload udev "
82         $0 stop  &&  $0 start
83         exit $?
84         ;;
85     reload)
86         exit 3
87         ;;
88     status)
89         echo -n "Checking for udev root directory: "
90         if [ -d $udev_root ]; then
91                 log_success_msg found
92         else
93                 log_warning_msg "not found"
94                 exit 3
95         fi
96         ;;
97     *)
98         echo "Usage: $0 {start|stop|status|restart|force-reload|reload}"
99         exit 1
100         ;;
101 esac