summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-08-19 15:25:06 +0000
committerRoy Marples <roy@marples.name>2008-08-19 15:25:06 +0000
commit1f227d62bf079e96771ee49ba499281da326f4e9 (patch)
tree245d2760b12171ac030e2ff107140644a5038817
parentcdace755394f8f07db6140b5e58891161c37a9a2 (diff)
downloadopenrc-1f227d62bf079e96771ee49ba499281da326f4e9.tar.gz
openrc-1f227d62bf079e96771ee49ba499281da326f4e9.tar.bz2
openrc-1f227d62bf079e96771ee49ba499281da326f4e9.tar.xz
Allow renaming of modules, #103 thanks to Sven.
-rw-r--r--conf.d/modules4
-rw-r--r--init.d/modules.in18
2 files changed, 19 insertions, 3 deletions
diff --git a/conf.d/modules b/conf.d/modules
index 2fc26cf..c5a3627 100644
--- a/conf.d/modules
+++ b/conf.d/modules
@@ -5,6 +5,10 @@
#modules_2_6="tun"
#modules="ohci1394"
+# You can give modules a different name when they load - the new name
+# will also be used to pick arguments below.
+#modules="dummy:dummy1"
+
# Give the modules some arguments if needed, per version if necessary.
#module_ieee1394_args="debug"
#module_ieee1394_args_2_6_23_gentoo_r5="ieee1394 ohci1394"
diff --git a/init.d/modules.in b/init.d/modules.in
index da5550c..06b5f17 100644
--- a/init.d/modules.in
+++ b/init.d/modules.in
@@ -23,7 +23,7 @@ start()
x=${KV#*.*.}
local KV_MICRO=${x%%-*}
- local list= x= xx= y= args= cnt=0
+ local list= x= xx= y= args= mpargs= cnt=0 a=
for x in "${KV}" \
${KV_MAJOR}.${KV_MINOR}.${KV_MICRO} \
${KV_MAJOR}.${KV_MINOR} \
@@ -34,17 +34,29 @@ start()
[ -z "${list}" ] && list=${modules}
for x in ${list}; do
- ebegin "Loading module ${x}"
+ a=${x#*:}
+ if [ "${a}" = "${x}" ]; then
+ unset mpargs
+ ebegin "Loading module ${x}"
+ else
+ x=${x%%:*}
+ mpargs="-o ${a}"
+ ebegin "Loading module ${x} as ${a}"
+ fi
+ aa=$(shell_var "${a}")
xx=$(shell_var "${x}")
for y in "${KV}" \
${KV_MAJOR}.${KV_MINOR}.${KV_MICRO} \
${KV_MAJOR}.${KV_MINOR} \
; do
+ eval args=\$module_${aa}_args_$(shell_var "${y}")
+ [ -n "${args}" ] && break
eval args=\$module_${xx}_args_$(shell_var "${y}")
[ -n "${args}" ] && break
done
+ [ -z "${args}" ] && eval args=\$module_${aa}_args
[ -z "${args}" ] && eval args=\$module_${xx}_args
- eval modprobe -q "${x}" "${args}"
+ eval modprobe -q "${mpargs}" "${x}" "${args}"
eend $? "Failed to load ${x}" && cnt=$((${cnt} + 1))
done
einfo "Autoloaded ${cnt} module(s)"