aboutsummaryrefslogtreecommitdiffstats
path: root/mandriva/rc.modules
diff options
context:
space:
mode:
authorColin Guthrie <colin@mageia.org>2011-10-21 01:28:48 +0100
committerColin Guthrie <colin@mageia.org>2011-10-21 10:10:39 +0100
commitbe75c98a06d569fbaa2d86f92676af961795d094 (patch)
treee2ce8ce7ffb97af34164634a3fbd8630dc7463e8 /mandriva/rc.modules
parent4688ea25c9a5a87e48f89fc91a3c93a7c8c95b4a (diff)
downloadinitscripts-be75c98a06d569fbaa2d86f92676af961795d094.tar
initscripts-be75c98a06d569fbaa2d86f92676af961795d094.tar.gz
initscripts-be75c98a06d569fbaa2d86f92676af961795d094.tar.bz2
initscripts-be75c98a06d569fbaa2d86f92676af961795d094.tar.xz
initscripts-be75c98a06d569fbaa2d86f92676af961795d094.zip
Add the mdkconf patch
Diffstat (limited to 'mandriva/rc.modules')
-rw-r--r--mandriva/rc.modules44
1 files changed, 44 insertions, 0 deletions
diff --git a/mandriva/rc.modules b/mandriva/rc.modules
new file mode 100644
index 00000000..e5f7e01b
--- /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
+
+if [ -n "$TOLOAD" ]; then
+ logger -t $0 "Loading modules:"$TOLOAD
+ /sbin/modprobe -a $TOLOAD 2>/dev/null
+fi