[1c48007] | 1 | #!/bin/sh
|
---|
| 2 | ########################################################################
|
---|
[0cda898] | 3 | # Begin udev
|
---|
[1c48007] | 4 | #
|
---|
| 5 | # Description : Udev cold-plugging script
|
---|
| 6 | #
|
---|
| 7 | # Authors : Zack Winkles, Alexander E. Patrakov
|
---|
[f874424] | 8 | # DJ Lucas - dj@linuxfromscratch.org
|
---|
[0cda898] | 9 | # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
|
---|
[1c48007] | 10 | #
|
---|
[0cda898] | 11 | # Version : LFS 7.0
|
---|
[1c48007] | 12 | #
|
---|
| 13 | ########################################################################
|
---|
| 14 |
|
---|
[0cda898] | 15 | ### BEGIN INIT INFO
|
---|
[40690e1] | 16 | # Provides: udev $time
|
---|
[0cda898] | 17 | # Required-Start:
|
---|
| 18 | # Should-Start: modules
|
---|
| 19 | # Required-Stop:
|
---|
| 20 | # Should-Stop:
|
---|
| 21 | # Default-Start: S
|
---|
| 22 | # Default-Stop:
|
---|
| 23 | # Short-Description: Populates /dev with device nodes.
|
---|
| 24 | # Description: Mounts a tempfs on /dev and starts the udevd daemon.
|
---|
| 25 | # Device nodes are created as defined by udev.
|
---|
| 26 | # X-LFS-Provided-By: LFS
|
---|
| 27 | ### END INIT INFO
|
---|
[1c48007] | 28 |
|
---|
[f874424] | 29 | . /lib/lsb/init-functions
|
---|
[1c48007] | 30 |
|
---|
[0cda898] | 31 | case "${1}" in
|
---|
| 32 | start)
|
---|
[f874424] | 33 | log_info_msg "Populating /dev with device nodes... "
|
---|
[0cda898] | 34 | if ! grep -q '[[:space:]]sysfs' /proc/mounts; then
|
---|
[f874424] | 35 | log_failure_msg2
|
---|
| 36 | msg="FAILURE:\n\nUnable to create "
|
---|
| 37 | msg="${msg}devices without a SysFS filesystem\n\n"
|
---|
| 38 | msg="${msg}After you press Enter, this system "
|
---|
| 39 | msg="${msg}will be halted and powered off.\n\n"
|
---|
| 40 | log_info_msg "$msg"
|
---|
| 41 | log_info_msg "Press Enter to continue..."
|
---|
[0cda898] | 42 | wait_for_user
|
---|
| 43 | /etc/rc.d/init.d/halt stop
|
---|
| 44 | fi
|
---|
[1c48007] | 45 |
|
---|
[0cda898] | 46 | # Start the udev daemon to continually watch for, and act on,
|
---|
| 47 | # uevents
|
---|
[f6fe500] | 48 | /sbin/udevd --daemon
|
---|
[1c48007] | 49 |
|
---|
[0cda898] | 50 | # Now traverse /sys in order to "coldplug" devices that have
|
---|
| 51 | # already been discovered
|
---|
[f6fe500] | 52 | /sbin/udevadm trigger --action=add --type=subsystems
|
---|
| 53 | /sbin/udevadm trigger --action=add --type=devices
|
---|
| 54 | /sbin/udevadm trigger --action=change --type=devices
|
---|
[1c48007] | 55 |
|
---|
[0cda898] | 56 | # Now wait for udevd to process the uevents we triggered
|
---|
[85ce884e] | 57 | if ! is_true "$OMIT_UDEV_SETTLE"; then
|
---|
[f6fe500] | 58 | /sbin/udevadm settle
|
---|
[85ce884e] | 59 | fi
|
---|
[c899581] | 60 |
|
---|
| 61 | # If any LVM based partitions are on the system, ensure they
|
---|
| 62 | # are activated so they can be used.
|
---|
| 63 | if [ -x /sbin/vgchange ]; then /sbin/vgchange -a y >/dev/null; fi
|
---|
| 64 |
|
---|
[642e2e9] | 65 | log_success_msg2
|
---|
[0cda898] | 66 | ;;
|
---|
[1c48007] | 67 |
|
---|
[0cda898] | 68 | *)
|
---|
| 69 | echo "Usage ${0} {start}"
|
---|
| 70 | exit 1
|
---|
| 71 | ;;
|
---|
[1c48007] | 72 | esac
|
---|
| 73 |
|
---|
[f874424] | 74 | exit 0
|
---|
| 75 |
|
---|
[0cda898] | 76 | # End udev
|
---|