1
0

udev_retry 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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-Provided-By: LFS
  16. ### END INIT INFO
  17. . /lib/lsb/init-functions
  18. MESSAGE="Retrying failed uevents, if any..."
  19. case "${1}" in
  20. start)
  21. # From Debian: "copy the rules generated before / was mounted
  22. # read-write":
  23. for file in /dev/.udev/tmp-rules--*; do
  24. dest=${file##*tmp-rules--}
  25. [ "$dest" = '*' ] && break
  26. cat $file >> /etc/udev/rules.d/$dest
  27. rm -f $file
  28. done
  29. # Re-trigger the failed uevents in hope they will succeed now
  30. /sbin/udevadm trigger --type=failed --action=add
  31. # Now wait for udevd to process the uevents we triggered
  32. /sbin/udevadm settle
  33. evaluate_retval standard
  34. ;;
  35. *)
  36. echo "Usage ${0} {start}"
  37. exit 1
  38. ;;
  39. esac
  40. # End $RC_BASE/init.d/udev_retry