diff options
Diffstat (limited to 'mandriva/rc.modules')
-rw-r--r-- | mandriva/rc.modules | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/mandriva/rc.modules b/mandriva/rc.modules new file mode 100644 index 00000000..fadc9804 --- /dev/null +++ b/mandriva/rc.modules @@ -0,0 +1,44 @@ +#!/bin/sh +# (c) Mandriva, Chmouel Boudjnah <chmouel@mandriva.com> +# $Id$ +# description: launch modules specified in /etc/modules inspired by a +# Debian idea. + +MODULES=/etc/modprobe.preload +MODULES_D=$MODULES.d + +# hardcoded from /etc/init.d/functions (to be faster and dash compliant) +strstr() { + [ "${1#*$2*}" = "$1" ] && return 1 + return 0 +} + +cmdline=$(cat /proc/cmdline) +if strstr "$cmdline" modprobedebug; then + MODPROBE_OPTIONS="-v" + export MODPROBE_OPTIONS + gprintf "Pre-loading modules\n" +fi + +echo_modules() { + # Loop over every line + while read module args + do + case "$module" in + \#*|"") continue ;; + esac + echo $module + done +} + +TOLOAD="" +for f in $MODULES $MODULES_D/*; do + [ -f $f ] || continue + NEW=$( (cat $f; echo) | echo_modules ) + [ -n "$NEW" ] && TOLOAD="$TOLOAD $NEW" +done + +[ -z "$TOLOAD" ] && exit 0 + +echo "Loading modules:"$TOLOAD >&2 +/sbin/modprobe -a $TOLOAD |