modules.sh 681 B

1234567891011121314151617181920212223242526272829
  1. #!/bin/sh
  2. MODULES=/etc/modules
  3. # Check that the kernel has module support.
  4. [ -e /proc/ksyms -o -e /proc/modules ] || exit 0
  5. case "${1}" in
  6. start)
  7. # Exit if there's no modules file or there are no valid entries
  8. [ -r ${MODULES} ] && grep -Eqv '^($|#)' ${MODULES} || exit 0
  9. while read module args; do
  10. # Ignore comments and blank lines.
  11. case "$module" in
  12. ""|"#"*) continue ;;
  13. esac
  14. # Try to load the module with its arguments
  15. modprobe ${module} ${args} > /dev/null
  16. done < ${MODULES}
  17. ;;
  18. *)
  19. echo "Usage: ${0} {start}"
  20. exit 1
  21. ;;
  22. esac