blob: fadc9804c9579c1705b3f716ae94f1cf2d01536a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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
|