Allow renaming of modules, #103 thanks to Sven.
This commit is contained in:
parent
cdace75539
commit
1f227d62bf
@ -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"
|
||||
|
@ -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)"
|
||||
|
Loading…
Reference in New Issue
Block a user