1 |
commit: be990b308ae2e7a725852f22f285267dcfeeaa2a |
2 |
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Jul 4 07:48:51 2011 +0000 |
4 |
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Jul 4 07:48:51 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=be990b30 |
7 |
|
8 |
Bug 373808: init.d/modules skipped certain variable combinations |
9 |
|
10 |
The version iteration code missed certain combinations: |
11 |
KV=1.2.3.4 |
12 |
skips: 1.2.3, 1 |
13 |
KV=1.2.3 |
14 |
skips: 1 |
15 |
|
16 |
Simplify the code to use a loop and build the list of versions directly |
17 |
instead of unique variables per version component. |
18 |
|
19 |
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org> |
20 |
|
21 |
--- |
22 |
conf.d/modules | 10 +++++++--- |
23 |
init.d/modules.in | 28 ++++++++++++++-------------- |
24 |
2 files changed, 21 insertions(+), 17 deletions(-) |
25 |
|
26 |
diff --git a/conf.d/modules b/conf.d/modules |
27 |
index c5a3627..a062a62 100644 |
28 |
--- a/conf.d/modules |
29 |
+++ b/conf.d/modules |
30 |
@@ -1,8 +1,10 @@ |
31 |
# You can define a list modules for a specific kernel version, |
32 |
# a released kernel version, a main kernel version or just a list. |
33 |
+# The most specific versioned variable will take precedence. |
34 |
#modules_2_6_23_gentoo_r5="ieee1394 ohci1394" |
35 |
#modules_2_6_23="tun ieee1394" |
36 |
#modules_2_6="tun" |
37 |
+#modules_2="ipv6" |
38 |
#modules="ohci1394" |
39 |
|
40 |
# You can give modules a different name when they load - the new name |
41 |
@@ -10,10 +12,12 @@ |
42 |
#modules="dummy:dummy1" |
43 |
|
44 |
# Give the modules some arguments if needed, per version if necessary. |
45 |
+# Again, the most specific versioned variable will take precedence. |
46 |
#module_ieee1394_args="debug" |
47 |
-#module_ieee1394_args_2_6_23_gentoo_r5="ieee1394 ohci1394" |
48 |
-#module_ieee1394_args_2_6_23="tun ieee1394" |
49 |
-#module_ieee1394_args_2_6="tun" |
50 |
+#module_ieee1394_args_2_6_23_gentoo_r5="debug2" |
51 |
+#module_ieee1394_args_2_6_23="debug3" |
52 |
+#module_ieee1394_args_2_6="debug4" |
53 |
+#module_ieee1394_args_2="debug5" |
54 |
|
55 |
# You should consult your kernel documentation and configuration |
56 |
# for a list of modules and their options. |
57 |
|
58 |
diff --git a/init.d/modules.in b/init.d/modules.in |
59 |
index ee4fdab..631e2e5 100644 |
60 |
--- a/init.d/modules.in |
61 |
+++ b/init.d/modules.in |
62 |
@@ -16,18 +16,21 @@ start() |
63 |
# support compiled in ... |
64 |
[ ! -f /proc/modules ] && return 0 |
65 |
|
66 |
- local KV=$(uname -r) |
67 |
- local KV_MAJOR=${KV%%.*} |
68 |
- local x=${KV#*.} |
69 |
- local KV_MINOR=${x%%.*} |
70 |
- x=${KV#*.*.} |
71 |
- local KV_MICRO=${x%%-*} |
72 |
+ local KV x y kv_variant_list |
73 |
+ KV=$(uname -r) |
74 |
+ # full $KV |
75 |
+ kv_variant_list="${KV}" |
76 |
+ # remove any KV_EXTRA options to just get the full version |
77 |
+ x=${KV%%-*} |
78 |
+ # now slowly strip them |
79 |
+ while [ -n "$x" ] && [ "$x" != "$y" ]; do |
80 |
+ kv_variant_list="${kv_variant_list} $x" |
81 |
+ y=$x |
82 |
+ x=${x%.*} |
83 |
+ done |
84 |
|
85 |
local list= x= xx= y= args= mpargs= cnt=0 a= |
86 |
- for x in "$KV" \ |
87 |
- $KV_MAJOR.$KV_MINOR.$KV_MICRO \ |
88 |
- $KV_MAJOR.$KV_MINOR \ |
89 |
- ; do |
90 |
+ for x in $kv_variant_list ; do |
91 |
eval list=\$modules_$(shell_var "$x") |
92 |
[ -n "$list" ] && break |
93 |
done |
94 |
@@ -45,10 +48,7 @@ start() |
95 |
fi |
96 |
aa=$(shell_var "$a") |
97 |
xx=$(shell_var "$x") |
98 |
- for y in "$KV" \ |
99 |
- $KV_MAJOR.$KV_MINOR.$KV_MICRO \ |
100 |
- $KV_MAJOR.$KV_MINOR \ |
101 |
- ; do |
102 |
+ for y in $kv_variant_list ; do |
103 |
eval args=\$module_${aa}_args_$(shell_var "$y") |
104 |
[ -n "${args}" ] && break |
105 |
eval args=\$module_${xx}_args_$(shell_var "$y") |