public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Robin H. Johnson" <robbat2@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/openrc:master commit in: init.d/, conf.d/
Date: Mon,  4 Jul 2011 07:52:40 +0000 (UTC)	[thread overview]
Message-ID: <be990b308ae2e7a725852f22f285267dcfeeaa2a.robbat2@gentoo> (raw)

commit:     be990b308ae2e7a725852f22f285267dcfeeaa2a
Author:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Mon Jul  4 07:48:51 2011 +0000
Commit:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Mon Jul  4 07:48:51 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=be990b30

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 <AT> gentoo.org>

---
 conf.d/modules    |   10 +++++++---
 init.d/modules.in |   28 ++++++++++++++--------------
 2 files changed, 21 insertions(+), 17 deletions(-)

diff --git a/conf.d/modules b/conf.d/modules
index c5a3627..a062a62 100644
--- a/conf.d/modules
+++ b/conf.d/modules
@@ -1,8 +1,10 @@
 # You can define a list modules for a specific kernel version,
 # a released kernel version, a main kernel version or just a list.
+# The most specific versioned variable will take precedence.
 #modules_2_6_23_gentoo_r5="ieee1394 ohci1394"
 #modules_2_6_23="tun ieee1394"
 #modules_2_6="tun"
+#modules_2="ipv6"
 #modules="ohci1394"
 
 # You can give modules a different name when they load - the new name
@@ -10,10 +12,12 @@
 #modules="dummy:dummy1"
 
 # Give the modules some arguments if needed, per version if necessary.
+# Again, the most specific versioned variable will take precedence.
 #module_ieee1394_args="debug"
-#module_ieee1394_args_2_6_23_gentoo_r5="ieee1394 ohci1394"
-#module_ieee1394_args_2_6_23="tun ieee1394"
-#module_ieee1394_args_2_6="tun"
+#module_ieee1394_args_2_6_23_gentoo_r5="debug2"
+#module_ieee1394_args_2_6_23="debug3"
+#module_ieee1394_args_2_6="debug4"
+#module_ieee1394_args_2="debug5"
 
 # You should consult your kernel documentation and configuration
 # for a list of modules and their options.

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")



             reply	other threads:[~2011-07-04  7:52 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-04  7:52 Robin H. Johnson [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-10-06 19:44 [gentoo-commits] proj/openrc:master commit in: init.d/, conf.d/ William Hubbs
2017-05-22 17:54 William Hubbs
2016-04-25 17:12 William Hubbs
2016-01-19 19:37 William Hubbs
2016-01-13 17:02 William Hubbs
2014-08-22 19:10 William Hubbs
2014-08-08 23:19 ` William Hubbs
2014-01-05 21:59 William Hubbs
2012-10-26  0:58 William Hubbs
2012-02-18 19:11 William Hubbs
2012-02-18 19:11 William Hubbs
2011-11-26 18:22 Mike Frysinger
2011-11-23  0:55 William Hubbs
2011-11-07  4:07 William Hubbs
2011-11-06 20:04 William Hubbs
2011-09-27 16:16 Christian Ruppert
2011-06-24  2:58 William Hubbs

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=be990b308ae2e7a725852f22f285267dcfeeaa2a.robbat2@gentoo \
    --to=robbat2@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox