* Merged newxml into HEAD
[linux_from_scratch.git] / bootscripts / contrib / init.d / udev
blobeb25856867b198185469c30ca45c36f337b5ab01
1 #!/bin/sh
2 # Begin $rc_base/init.d/udev - Udev cold-plugging script
4 # Written by Zack Winkles - winkie@linuxfromscratch.org
6 . /etc/sysconfig/rc
7 . $rc_functions
9 # Assure that sysfs is mounted and that udev is present.
10 [ -d /sys/block -a -x /sbin/udev ] || exit 0
12 # Create some things that sysfs does not, and should not export for us. Feel
13 # free to add devices to this list.
14 make_extra_nodes() {
15 ln -s /proc/self/fd /dev/fd
16 ln -s /proc/self/fd/0 /dev/stdin
17 ln -s /proc/self/fd/1 /dev/stdout
18 ln -s /proc/self/fd/2 /dev/stderr
19 ln -s /proc/kcore /dev/core
20 mkdir /dev/pts
21 mkdir /dev/shm
24 case "$1" in
25 start)
26 # When the hotplug package isn't installed, make sure that udev
27 # still gets hotplug events.
28 if [ ! -x /sbin/hotplug ]; then
29 echo /sbin/udev > /proc/sys/kernel/hotplug
32 echo "Populating /dev with device nodes..."
34 # Mount a temporary file system over /dev, so that any devices
35 # made or removed during this boot don't affect the next one.
36 # The reason we don't write to mtab is because we don't ever
37 # want /dev to be unavailable (such as by `umount -a').
38 mount -n -t ramfs ramfs /dev
40 # Populate /dev with all the devices that are already available,
41 # and save it's status so we can report failures.
42 udevstart || failed=1
44 # Now, create some required files/directories/devices that sysfs
45 # doesn't export for us.
46 make_extra_nodes
48 # When reporting the status, base it on the success or failure
49 # of the `udevstart' command, since that's the most important.
50 (exit $failed)
51 evaluate_retval
54 echo "Usage $0 {start}"
55 exit 1
57 esac
59 # End $rc_base/init.d/udev