On Sat, Dec 05, 2009 at 07:15:55PM +0400, Stepan Golosunov wrote:
> 05.12.2009 в 13:33:13 +0100 Iustin Pop написал(а):
> > Yes, but you're tying here together the grub-mkconfig_lib change and the
> > linux/linux16 change, and these were not done together. These two should
> > be split, and the linux16 tested via the presence of
> > /usr/lib/grub/i386-pc/linux16.mod.
> > 
> > But here we get very deep into details of grub, which is not really
> > recommended - what if grub changes its internal paths tomorrow?
> 
> I think that for the purpose of upgrading from lenny it is enough to
> check for presence of grub-mkconfig_lib (if both changes are already
> in squeeze).

Yep, they both are. As long as this is done indeed for supporting
upgrades from lenny, and it doesn't matter that partial package sets
from unstable won't be handled properly, seems like a good option.

Then the latest version I propose is attached (and I'll try to see if my
AM accepts it and sponsors a NMU). Tested and works (in a virtual
machine) for both lenny and sid.

iustin
diff -urN /tmp/memtest86+-4.00/debian/grub memtest86+-4.00/debian/grub
--- /tmp/memtest86+-4.00/debian/grub	2009-12-05 18:11:46.000000000 +0100
+++ memtest86+-4.00/debian/grub	2009-12-05 18:14:43.655898161 +0100
@@ -1,8 +1,20 @@
 #!/bin/sh
 set -e
 
-. /usr/lib/grub/grub-mkconfig_lib
+
 if test -e /boot/memtest86+.bin ; then
+  if [ -f /usr/lib/grub/grub-mkconfig_lib ]; then
+    . /usr/lib/grub/grub-mkconfig_lib
+    LX=linux16
+  elif [ -f /usr/lib/grub/update-grub_lib ]; then
+    . /usr/lib/grub/update-grub_lib
+    LX=linux
+  else
+    # no grub file, so we notify and exit gracefully
+    echo "Cannot find grub config file, exiting." >&2
+    exit 0
+  fi
+
   MEMTESTPATH=$( make_system_path_relative_to_its_root "/boot/memtest86+.bin" )
   echo "Found memtest86+ image: $MEMTESTPATH" >&2
   cat << EOF
@@ -10,13 +22,13 @@
 EOF
   prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/"
   cat << EOF
-	linux16	$MEMTESTPATH
+	$LX	$MEMTESTPATH
 }
 menuentry "Memory test (memtest86+, serial console 115200)" {
 EOF
   prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/"
   cat << EOF
-	linux16	$MEMTESTPATH console=ttyS0,115200n8
+	$LX	$MEMTESTPATH console=ttyS0,115200n8
 }
 EOF
 fi

Reply via email to