summaryrefslogtreecommitdiff
path: root/init.d
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2011-07-04 07:48:51 +0000
committerRobin H. Johnson <robbat2@gentoo.org>2011-07-04 07:48:51 +0000
commitbe990b308ae2e7a725852f22f285267dcfeeaa2a (patch)
tree7f3c3e29ed2bdb6120d3a234130c38ce643a553d /init.d
parent9076baa573a6e7a0ad7fb0de1919b051c8b3b012 (diff)
downloadopenrc-be990b308ae2e7a725852f22f285267dcfeeaa2a.tar.gz
openrc-be990b308ae2e7a725852f22f285267dcfeeaa2a.tar.bz2
openrc-be990b308ae2e7a725852f22f285267dcfeeaa2a.tar.xz
Bug 373808: init.d/modules skipped certain variable combinations
The version iteration code missed certain combinations: KV=1.2.3.4 skips: 1.2.3, 1 KV=1.2.3 skips: 1 Simplify the code to use a loop and build the list of versions directly instead of unique variables per version component. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Diffstat (limited to 'init.d')
-rw-r--r--init.d/modules.in28
1 files changed, 14 insertions, 14 deletions
diff --git a/init.d/modules.in b/init.d/modules.in
index ee4fdab..631e2e5 100644
--- a/init.d/modules.in
+++ b/init.d/modules.in
@@ -16,18 +16,21 @@ start()
# support compiled in ...
[ ! -f /proc/modules ] && return 0
- local KV=$(uname -r)
- local KV_MAJOR=${KV%%.*}
- local x=${KV#*.}
- local KV_MINOR=${x%%.*}
- x=${KV#*.*.}
- local KV_MICRO=${x%%-*}
+ local KV x y kv_variant_list
+ KV=$(uname -r)
+ # full $KV
+ kv_variant_list="${KV}"
+ # remove any KV_EXTRA options to just get the full version
+ x=${KV%%-*}
+ # now slowly strip them
+ while [ -n "$x" ] && [ "$x" != "$y" ]; do
+ kv_variant_list="${kv_variant_list} $x"
+ y=$x
+ x=${x%.*}
+ done
local list= x= xx= y= args= mpargs= cnt=0 a=
- for x in "$KV" \
- $KV_MAJOR.$KV_MINOR.$KV_MICRO \
- $KV_MAJOR.$KV_MINOR \
- ; do
+ for x in $kv_variant_list ; do
eval list=\$modules_$(shell_var "$x")
[ -n "$list" ] && break
done
@@ -45,10 +48,7 @@ start()
fi
aa=$(shell_var "$a")
xx=$(shell_var "$x")
- for y in "$KV" \
- $KV_MAJOR.$KV_MINOR.$KV_MICRO \
- $KV_MAJOR.$KV_MINOR \
- ; do
+ for y in $kv_variant_list ; do
eval args=\$module_${aa}_args_$(shell_var "$y")
[ -n "${args}" ] && break
eval args=\$module_${xx}_args_$(shell_var "$y")