udev 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #!/bin/sh
  2. ########################################################################
  3. # Begin $rc_base/init.d/udev
  4. #
  5. # Description : Udev cold-plugging script
  6. #
  7. # Authors : Zack Winkles, Alexander E. Patrakov
  8. #
  9. # Version : 00.02
  10. #
  11. # Notes :
  12. #
  13. ########################################################################
  14. . /etc/sysconfig/rc
  15. . ${rc_functions}
  16. case "${1}" in
  17. start)
  18. boot_mesg "Populating /dev with device nodes..."
  19. if ! grep -q '[[:space:]]sysfs' /proc/mounts; then
  20. echo_failure
  21. boot_mesg -n "FAILURE:\n\nUnable to create" ${FAILURE}
  22. boot_mesg -n " devices without a SysFS filesystem"
  23. boot_mesg -n "\n\nAfter you press Enter, this system"
  24. boot_mesg -n " will be halted and powered off."
  25. boot_mesg -n "\n\nPress Enter to continue..." ${INFO}
  26. boot_mesg "" ${NORMAL}
  27. read ENTER
  28. /etc/rc.d/init.d/halt stop
  29. fi
  30. # Mount a temporary file system over /dev, so that any devices
  31. # made or removed during this boot don't affect the next one.
  32. # The reason we don't write to mtab is because we don't ever
  33. # want /dev to be unavailable (such as by `umount -a').
  34. mount -n -t tmpfs tmpfs /dev -o mode=755
  35. if [ ${?} != 0 ]; then
  36. echo_failure
  37. boot_mesg -n "FAILURE:\n\nCannot mount a tmpfs" ${FAILURE}
  38. boot_mesg -n " onto /dev, this system will be halted."
  39. boot_mesg -n "\n\nAfter you press Enter, this system"
  40. boot_mesg -n " will be halted and powered off."
  41. boot_mesg -n "\n\nPress Enter to continue..." ${INFO}
  42. boot_mesg "" ${NORMAL}
  43. read ENTER
  44. /etc/rc.d/init.d/halt stop
  45. fi
  46. # Udev handles uevents itself, so we don't need to have
  47. # the kernel call out to any binary in response to them
  48. echo > /proc/sys/kernel/hotplug
  49. # Copy static device nodes to /dev
  50. cp -a /lib/udev/devices/* /dev
  51. # Start the udev daemon to continually watch for, and act on,
  52. # uevents
  53. /sbin/udevd --daemon
  54. # Now traverse /sys in order to "coldplug" devices that have
  55. # already been discovered
  56. /sbin/udevadm trigger
  57. # Now wait for udevd to process the uevents we triggered
  58. /sbin/udevadm settle
  59. evaluate_retval
  60. ;;
  61. *)
  62. echo "Usage ${0} {start}"
  63. exit 1
  64. ;;
  65. esac
  66. # End $rc_base/init.d/udev