home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh -e
- ### BEGIN INIT INFO
- # Provides: module-init-tools
- # Required-Start:
- # Required-Stop:
- # Should-Start: checkroot
- # Should-stop:
- # Default-Start: S
- # Default-Stop:
- # Short-Description: Process /etc/modules.
- # Description: Load the modules listed in /etc/modules.
- ### END INIT INFO
-
- # Silently exit if the kernel does not support modules or needs modutils.
- [ -f /proc/modules ] || exit 0
- [ ! -f /proc/ksyms ] || exit 0
- [ -x /sbin/modprobe ] || exit 0
-
- . /etc/default/rcS
- . /lib/lsb/init-functions
-
- PATH="/sbin:/bin"
-
- KVER=$(uname -r)
- KMAJ=${KVER%${KVER#*.*[^.]}}
- KMAJ=${KMAJ%.}
-
- if [ -e /etc/modules-$KVER ]; then
- MODULES_FILE=/etc/modules-$KVER
- elif [ -e /etc/modules-$KMAJ ]; then
- MODULES_FILE=/etc/modules-$KMAJ
- else
- MODULES_FILE=/etc/modules
- fi
-
- # Loop over every line in /etc/modules.
- log_begin_msg 'Loading manual drivers...'
- grep '^[^#]' $MODULES_FILE | \
- while read module args; do
- [ "$module" ] || continue
- if [ "$VERBOSE" != no ]; then
- log_begin_msg "Trying module $module"
- if modprobe $module $args; then
- log_end_msg $?
- else
- log_end_msg $? || true
- fi
- else
- modprobe $module $args > /dev/null 2>&1 || true
- fi
- done
- log_end_msg 0
-
- exit 0
-