1
0

udev 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. # Udev handles uevents itself, so we don't need to have
  43. # the kernel call out to any binary in response to them
  44. echo > /proc/sys/kernel/hotplug
  45. # Start the udev daemon to continually watch for, and act on,
  46. # uevents
  47. /lib/udev/udevd --daemon
  48. # Now traverse /sys in order to "coldplug" devices that have
  49. # already been discovered
  50. /sbin/udevadm trigger --action=add --type=subsystems
  51. /sbin/udevadm trigger --action=add --type=devices
  52. # Now wait for udevd to process the uevents we triggered
  53. /sbin/udevadm settle
  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