[1c48007] | 1 | #!/bin/sh
|
---|
| 2 | # Begin $rc_base/init.d/udev
|
---|
| 3 |
|
---|
| 4 | ### BEGIN INIT INFO
|
---|
| 5 | # Provides: udev
|
---|
[67de919] | 6 | # Required-Start:
|
---|
| 7 | # Should-Start: modules
|
---|
[1c48007] | 8 | # Required-Stop:
|
---|
| 9 | # Should-Stop:
|
---|
[010d108] | 10 | # Default-Start: S
|
---|
[1c48007] | 11 | # Default-Stop:
|
---|
| 12 | # Short-Description: Populated /dev with device nodes.
|
---|
| 13 | # Description: Mounts a tempfs on /dev and starts the udevd daemon.
|
---|
| 14 | # Device nodes are created as defined by udev.
|
---|
| 15 | # X-LFS-Default-Start: S15
|
---|
| 16 | # X-LFS-Default-Stop:
|
---|
| 17 | # X-LFS-Provided-By: LFS
|
---|
| 18 | ### END INIT INFO
|
---|
| 19 |
|
---|
| 20 | . /lib/lsb/init-functions
|
---|
| 21 |
|
---|
| 22 | MESSAGE="Populating /dev with device nodes..."
|
---|
| 23 |
|
---|
| 24 | case "${1}" in
|
---|
| 25 | start)
|
---|
| 26 | if ! grep -q '[[:space:]]sysfs' /proc/mounts; then
|
---|
| 27 | echo_failure
|
---|
| 28 | boot_mesg -n "FAILURE:\n\nUnable to create" ${FAILURE}
|
---|
| 29 | boot_mesg -n " devices without a SysFS filesystem"
|
---|
| 30 | boot_mesg -n "\n\nAfter you press Enter, this system"
|
---|
| 31 | boot_mesg -n " will be halted and powered off."
|
---|
| 32 | boot_mesg -n "\n\nPress Enter to continue..." ${INFO}
|
---|
| 33 | boot_mesg "" ${NORMAL}
|
---|
| 34 | read ENTER
|
---|
| 35 | /etc/rc.d/init.d/halt stop
|
---|
| 36 | fi
|
---|
| 37 |
|
---|
| 38 | # Mount a temporary file system over /dev, so that any devices
|
---|
| 39 | # made or removed during this boot don't affect the next one.
|
---|
| 40 | # The reason we don't write to mtab is because we don't ever
|
---|
| 41 | # want /dev to be unavailable (such as by `umount -a').
|
---|
| 42 | mount -n -t tmpfs tmpfs /dev -o mode=755
|
---|
| 43 | if [ ${?} != 0 ]; then
|
---|
| 44 | echo_failure
|
---|
| 45 | boot_mesg -n "FAILURE:\n\nCannot mount a tmpfs" ${FAILURE}
|
---|
| 46 | boot_mesg -n " onto /dev, this system will be halted."
|
---|
| 47 | boot_mesg -n "\n\nAfter you press Enter, this system"
|
---|
| 48 | boot_mesg -n " will be halted and powered off."
|
---|
| 49 | boot_mesg -n "\n\nPress Enter to continue..." ${INFO}
|
---|
| 50 | boot_mesg "" ${NORMAL}
|
---|
| 51 | read ENTER
|
---|
| 52 | /etc/rc.d/init.d/halt stop
|
---|
| 53 | fi
|
---|
| 54 |
|
---|
| 55 | # Udev handles uevents itself, so we don't need to have
|
---|
| 56 | # the kernel call out to any binary in response to them
|
---|
| 57 | echo > /proc/sys/kernel/hotplug
|
---|
| 58 |
|
---|
| 59 | # Copy static device nodes to /dev
|
---|
| 60 | cp -a /lib/udev/devices/* /dev
|
---|
| 61 |
|
---|
| 62 | # Start the udev daemon to continually watch for, and act on,
|
---|
| 63 | # uevents
|
---|
| 64 | /sbin/udevd --daemon
|
---|
| 65 |
|
---|
| 66 | # Now traverse /sys in order to "coldplug" devices that have
|
---|
| 67 | # already been discovered
|
---|
| 68 | /sbin/udevadm trigger
|
---|
| 69 |
|
---|
| 70 | # Now wait for udevd to process the uevents we triggered
|
---|
| 71 | /sbin/udevadm settle
|
---|
| 72 | evaluate_retval standard
|
---|
| 73 | ;;
|
---|
| 74 |
|
---|
| 75 | *)
|
---|
| 76 | echo "Usage ${0} {start}"
|
---|
| 77 | exit 1
|
---|
| 78 | ;;
|
---|
| 79 | esac
|
---|
| 80 |
|
---|
| 81 | # End $rc_base/init.d/udev
|
---|