udev 2.2 KB

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