modules 1.6 KB

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