home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / etc / init.d / module-init-tools < prev    next >
Encoding:
Text File  |  2006-07-04  |  1.2 KB  |  55 lines

  1. #!/bin/sh -e
  2. ### BEGIN INIT INFO
  3. # Provides:          module-init-tools
  4. # Required-Start:    
  5. # Required-Stop:     
  6. # Should-Start:      checkroot
  7. # Should-stop:
  8. # Default-Start:     S
  9. # Default-Stop:
  10. # Short-Description: Process /etc/modules.
  11. # Description:       Load the modules listed in /etc/modules.
  12. ### END INIT INFO
  13.  
  14. # Silently exit if the kernel does not support modules or needs modutils.
  15. [ -f /proc/modules ] || exit 0
  16. [ ! -f /proc/ksyms ] || exit 0
  17. [ -x /sbin/modprobe  ] || exit 0
  18.  
  19. . /etc/default/rcS
  20. . /lib/lsb/init-functions
  21.  
  22. PATH="/sbin:/bin"
  23.  
  24. KVER=$(uname -r)
  25. KMAJ=${KVER%${KVER#*.*[^.]}}
  26. KMAJ=${KMAJ%.}
  27.  
  28. if [ -e /etc/modules-$KVER ]; then
  29.   MODULES_FILE=/etc/modules-$KVER
  30. elif [ -e /etc/modules-$KMAJ ]; then
  31.   MODULES_FILE=/etc/modules-$KMAJ
  32. else
  33.   MODULES_FILE=/etc/modules
  34. fi
  35.  
  36. # Loop over every line in /etc/modules.
  37. log_begin_msg 'Loading manual drivers...'
  38. grep '^[^#]' $MODULES_FILE | \
  39. while read module args; do
  40.   [ "$module" ] || continue
  41.   if [ "$VERBOSE" != no ]; then
  42.     log_begin_msg "Trying module $module"
  43.     if modprobe $module $args; then
  44.       log_end_msg $?
  45.     else
  46.       log_end_msg $? || true
  47.     fi
  48.   else
  49.     modprobe $module $args > /dev/null 2>&1 || true
  50.   fi
  51. done
  52. log_end_msg 0
  53.  
  54. exit 0
  55.