aboutsummaryrefslogtreecommitdiff
path: root/init.d/modules.in
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 /init.d/modules.in
parentcdace755394f8f07db6140b5e58891161c37a9a2 (diff)
Allow renaming of modules, #103 thanks to Sven.
Diffstat (limited to 'init.d/modules.in')
-rw-r--r--init.d/modules.in18
1 files changed, 15 insertions, 3 deletions
diff --git a/init.d/modules.in b/init.d/modules.in
index da5550c1..06b5f179 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)"