Skip to contentSkip to conversation

make 10_linux' test_gt() a bit more generic

PATCH In review Robert Millan 2 participants 4 messages Aug 4, 2009 – Aug 10, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 make 10_linux' test_gt() a bit more generic

This makes 10_linux' test_gt() a bit more generic so that it can be moved (along with a few other functions) to grub-mkconfig_lib, where it'll be usable by 10_freebsd.

This will allow handling multiple kernel versions in 10_freebsd, like 10_linux does.

Signature · 5 lines
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."

2009-08-04 Robert Millan <[email protected]>

* util/grub.d/10_linux.in (test_gt): Strip any basename prefix, not just "vmlinu[zx]".

grub.d/10_linux.in +2 -2
Index: util/grub.d/10_linux.in
===================================================================
@@ -67,8 +67,8 @@ test_numeric ()
 
 test_gt ()
 {
-  local a=`echo $1 | sed -e "s/vmlinu[zx]-//g"`
-  local b=`echo $2 | sed -e "s/vmlinu[zx]-//g"`
+  local a=`echo $1 | sed -e "s/[^-]*-//g"`
+  local b=`echo $2 | sed -e "s/[^-]*-//g"`
   local cmp=gt
   if [ "x$b" = "x" ] ; then
     return 0
#1 lore raw

Committed. Also moved those functions to grub-mkconfig_lib.in.

Quoted 40 lines · Robert Millan

This makes 10_linux' test_gt() a bit more generic so that it can be moved (along with a few other functions) to grub-mkconfig_lib, where it'll be usable by 10_freebsd.

This will allow handling multiple kernel versions in 10_freebsd, like 10_linux does.

Signature · 13 lines
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."

2009-08-04  Robert Millan  <[email protected]>

	* util/grub.d/10_linux.in (test_gt): Strip any basename prefix,
	not just "vmlinu[zx]".

Index: util/grub.d/10_linux.in
===================================================================
grub.d/10_linux.in +2 -2
@@ -67,8 +67,8 @@ test_numeric ()
 
 test_gt ()
 {
-  local a=`echo $1 | sed -e "s/vmlinu[zx]-//g"`
-  local b=`echo $2 | sed -e "s/vmlinu[zx]-//g"`
+  local a=`echo $1 | sed -e "s/[^-]*-//g"`
+  local b=`echo $2 | sed -e "s/[^-]*-//g"`
   local cmp=gt
   if [ "x$b" = "x" ] ; then
     return 0

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 5 lines
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."
#2 lore raw
Quoted 2 lines · Robert Millan

Committed. Also moved those functions to grub-mkconfig_lib.in.

When comparing vmlinuz-2.6.31-rc4-wl and vmlinuz-2.6.31-rc5-wl, version_test_gt() ends up comparing "wl" and "wl".

Using the "g" modifier leads to the replacement being applied continuously until the last minus is consumed. The use of "g" wasn't warranted before, but it didn't have such effect.

I'm committing the fix.

Signature · 2 lines
Regards,
Pavel Roskin
#3 lore raw
Quoted 10 lines · Pavel Roskin
Quoted 2 lines · Robert Millan

Committed. Also moved those functions to grub-mkconfig_lib.in.

When comparing vmlinuz-2.6.31-rc4-wl and vmlinuz-2.6.31-rc5-wl, version_test_gt() ends up comparing "wl" and "wl".

Using the "g" modifier leads to the replacement being applied continuously until the last minus is consumed. The use of "g" wasn't warranted before, but it didn't have such effect.

You're right. I tend to use "g" without thinking. I should be more careful with this.

Quoted 1 line

I'm committing the fix.

Thanks.

Signature · 5 lines
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."