udev_retry 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/bin/sh
  2. # Begin $rc_base/init.d/udev_retry
  3. ### BEGIN INIT INFO
  4. # Provides: udev_retry
  5. # Required-Start: udev
  6. # Should-Start: $local_fs
  7. # Required-Stop:
  8. # Should-Stop:
  9. # Default-Start: S
  10. # Default-Stop:
  11. # Short-Description: Replays failed uevents and creates additonal devices.
  12. # Description: Replays any failed uevents that were skipped due to
  13. # slow hardware initialization, and creates those needed
  14. # device nodes
  15. # X-LFS-Default-Start: S45
  16. # X-LFS-Default-Stop:
  17. # X-LFS-Provided-By: LFS
  18. ### END INIT INFO
  19. . /lib/lsb/init-functions
  20. MESSAGE="Retrying failed uevents, if any..."
  21. case "${1}" in
  22. start)
  23. # From Debian: "copy the rules generated before / was mounted
  24. # read-write":
  25. for file in /dev/.udev/tmp-rules--*; do
  26. dest=${file##*tmp-rules--}
  27. [ "$dest" = '*' ] && break
  28. cat $file >> /etc/udev/rules.d/$dest
  29. rm -f $file
  30. done
  31. # Re-trigger the failed uevents in hope they will succeed now
  32. /sbin/udevadm trigger --retry-failed
  33. # Now wait for udevd to process the uevents we triggered
  34. /sbin/udevadm settle
  35. evaluate_retval standard
  36. ;;
  37. *)
  38. echo "Usage ${0} {start}"
  39. exit 1
  40. ;;
  41. esac
  42. # End $rc_base/init.d/udev_retry