S04modules 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #!/bin/sh
  2. # Assure that the kernel has module support.
  3. [ -e /proc/ksyms -o -e /proc/modules ] || exit 0
  4. THIS=$(basename $0)
  5. case "${1}" in
  6. start)
  7. # Exit if there's no modules file or there are no
  8. # valid entries
  9. if [ -r /etc/sysconfig/modules ]; then
  10. egrep -qv '^($|#)' /etc/sysconfig/modules
  11. if [ $? -ne 0 ]; then
  12. exit 0
  13. fi
  14. fi
  15. # Only try to load modules if the user has actually given us
  16. # some modules to load.
  17. while read MODULE ARGS; do
  18. # Ignore comments and blank lines.
  19. case "$MODULE" in
  20. ""|"#"*) continue ;;
  21. esac
  22. # Attempt to load the module, making
  23. # sure to pass any arguments provided.
  24. modprobe ${MODULE} ${ARGS} >/dev/null
  25. # Print the module name if successful,
  26. # otherwise take note.
  27. if [ $? -eq 0 ]; then
  28. echo "Loading module ${MODULE}: OK"
  29. else
  30. echo "Loading module ${MODULE}: ERROR"
  31. fi
  32. done < /etc/sysconfig/modules
  33. ;;
  34. stop)
  35. ;;
  36. *)
  37. echo "Usage: ${0} {start|stop}"
  38. exit 1
  39. ;;
  40. esac