S02modules 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #!/bin/sh
  2. ########################################################################
  3. #
  4. # Description : Module auto-loading script
  5. #
  6. # Authors : Zack Winkles
  7. #
  8. # Version : 00.00
  9. #
  10. # Notes :
  11. #
  12. ########################################################################
  13. . /etc/sysconfig/functions
  14. # Assure that the kernel has module support.
  15. [ -e /proc/ksyms -o -e /proc/modules ] || exit 0
  16. case "${1}" in
  17. start)
  18. # Exit if there's no modules file or there are no
  19. # valid entries
  20. [ -r /etc/sysconfig/modules ] &&
  21. egrep -qv '^($|#)' /etc/sysconfig/modules ||
  22. exit 0
  23. boot_mesg -n "Loading modules:" ${INFO}
  24. # Only try to load modules if the user has actually given us
  25. # some modules to load.
  26. while read module args; do
  27. # Ignore comments and blank lines.
  28. case "$module" in
  29. ""|"#"*) continue ;;
  30. esac
  31. # Attempt to load the module, making
  32. # sure to pass any arguments provided.
  33. modprobe ${module} ${args} >/dev/null
  34. # Print the module name if successful,
  35. # otherwise take note.
  36. if [ $? -eq 0 ]; then
  37. boot_mesg -n " ${module}" ${NORMAL}
  38. else
  39. failedmod="${failedmod} ${module}"
  40. fi
  41. done < /etc/sysconfig/modules
  42. boot_mesg "" ${NORMAL}
  43. # Print a message about successfully loaded
  44. # modules on the correct line.
  45. echo_ok
  46. # Print a failure message with a list of any
  47. # modules that may have failed to load.
  48. if [ -n "${failedmod}" ]; then
  49. boot_mesg "Failed to load modules:${failedmod}" ${FAILURE}
  50. echo_failure
  51. fi
  52. ;;
  53. *)
  54. echo "Usage: ${0} {start}"
  55. exit 1
  56. ;;
  57. esac