Bug#502446: patch second try... Bug#502446: grub-installer
Hi,
For Bug #502446: http://bugs.debian.org/502446
Here is updated patch which takes care odd partition offset of grub
legacy. Around frdev, I may have been too aggressive....
I will test this later ...
Osamu
diff -Nru grub-installer-1.35/debian/changelog grub-installer-1.35+nmu2/debian/changelog
--- grub-installer-1.35/debian/changelog 2008-09-30 03:31:13.000000000 +0900
+++ grub-installer-1.35+nmu2/debian/changelog 2008-10-19 15:08:37.000000000 +0900
@@ -1,3 +1,17 @@
+grub-installer (1.35+nmu2) experimental; urgency=low
+
+ * more hacking ... this should fix boot partition calculation
+ but it may be over correction for some RAID thingy.
+
+ -- Osamu Aoki <osamu@debian.org> Sun, 19 Oct 2008 15:07:24 +0900
+
+grub-installer (1.35+nmu1) experimental; urgency=low
+
+ * Non-maintainer upload. (I will not do it)
+ * support grub2 with correct message on device name convention
+
+ -- Osamu Aoki <osamu@debian.org> Sun, 19 Oct 2008 12:00:26 +0900
+
grub-installer (1.35) unstable; urgency=low
* Add support for MMC/SD card devices (mmcblkX).
diff -Nru grub-installer-1.35/debian/grub-installer.templates grub-installer-1.35+nmu2/debian/grub-installer.templates
--- grub-installer-1.35/debian/grub-installer.templates 2008-04-28 17:38:06.000000000 +0900
+++ grub-installer-1.35+nmu2/debian/grub-installer.templates 2008-10-19 10:52:13.000000000 +0900
@@ -95,6 +95,26 @@
your third drive (SCSI here);
- "(fd0)" or "/dev/fd0" will install GRUB to a floppy.
+Template: grub-installer/bootdev2
+Type: string
+# :sl2:
+_Description: Device for boot loader installation:
+ You need to make the newly installed system bootable, by installing
+ the GRUB boot loader on a bootable device. The usual way to do this is to
+ install GRUB on the master boot record of your first hard drive. If you
+ prefer, you can install GRUB elsewhere on the drive, or to another drive,
+ or even to a floppy.
+ .
+ The device can be specified using GRUB's "(hdn,m)" notation, or as a device
+ in /dev. Below are some examples:
+ - "(hd0)" or "/dev/hda" will install GRUB to the master boot record
+ of your first hard drive (IDE);
+ - "(hd0,2)" or "/dev/hda2" will use the second partition of your
+ first IDE drive;
+ - "(hd2,5)" or "/dev/sdc5" will use the first extended partition of
+ your third drive (SCSI here);
+ - "(fd0)" or "/dev/fd0" will install GRUB to a floppy.
+
Template: grub-installer/password
Type: password
# :sl2:
diff -Nru grub-installer-1.35/grub-installer grub-installer-1.35+nmu2/grub-installer
--- grub-installer-1.35/grub-installer 2008-09-30 03:24:48.000000000 +0900
+++ grub-installer-1.35+nmu2/grub-installer 2008-10-19 15:16:43.000000000 +0900
@@ -148,14 +148,14 @@
# GRUB's syntax
case "$host_os" in
linux*)
- echo "$tmp_drive" | sed "s%)$%,`expr $tmp_part - 1`)%"
+ echo "$tmp_drive" | sed "s%)$%,`expr $tmp_part - $grub_part_offset`)%"
;;
gnu*)
if echo $tmp_part | grep "^s" >/dev/null; then
tmp_pc_slice=$(echo $tmp_part | \
sed "s%s\([0-9]*\)[a-g]*$%\1%")
tmp_drive=$(echo "$tmp_drive" | \
- sed "s%)%,\`expr "$tmp_pc_slice" - 1\`)%")
+ sed "s%)%,\`expr "$tmp_pc_slice" - $grub_part_offset\`)%")
fi
if echo $tmp_part | grep "[a-g]$" >/dev/null; then
tmp_bsd_partition=$(echo "$tmp_part" | \
@@ -170,7 +170,7 @@
tmp_pc_slice=$(echo $tmp_part | \
sed "s%s\([0-9]*\)[a-h]*$%\1%")
tmp_drive=$(echo "$tmp_drive" | \
- sed "s%)%,\`expr "$tmp_pc_slice" - 1\`)%")
+ sed "s%)%,\`expr "$tmp_pc_slice" - $grub_part_offset\`)%")
fi
if echo $tmp_part | grep "[a-h]$" >/dev/null; then
tmp_bsd_partition=$(echo "$tmp_part" | \
@@ -279,7 +279,6 @@
if echo "$disc_offered" | grep -q "/$frdisk[0-9]\+"; then
frdev=/dev/mapper/$frdisk
frbootpart=${disc_offered#$frdev}
- frgrubroot=$(($frbootpart - 1))
frtype=sataraid
break
fi
@@ -292,7 +291,6 @@
grep -q "^/dev/mapper/${frdisk}-part[0-9]\+"; then
frdev=/dev/mapper/$frdisk
frbootpart=${disc_offered#$frdev}
- frgrubroot=$((${frbootpart#-part} - 1))
frtype=multipath
break
fi
@@ -369,10 +367,12 @@
grub)
grub_version="grub"
menu_file="menu.lst"
+ grub_part_offset="1"
;;
*)
grub_version="grub2"
menu_file="grub.cfg"
+ grub_part_offset="0"
;;
esac
@@ -477,7 +477,7 @@
if [ "$frdev" ]; then
if [ -e $ROOT$frdev ] && [ -e $ROOT$frdev$frbootpart ] && \
- [ $frgrubroot -ge 0 ]; then
+ [ $frgrubroot -ge 1 ]; then
db_subst grub-installer/$frtype GRUBROOT $ROOT$frdev$frbootpart
q=grub-installer/$frtype
else
@@ -512,7 +512,11 @@
state=2
fi
else
- db_input critical grub-installer/bootdev || true
+ case $grub_version in
+ grub) db_input critical grub-installer/bootdev || true ;;
+ grub2) db_input critical grub-installer/bootdev2 || true ;;
+ *) db_progress STOP ; exit 10 ;;
+ esac
if ! db_go; then
if [ "$q" ]; then
state=1
@@ -522,7 +526,11 @@
exit 10
fi
else
- db_get grub-installer/bootdev
+ case $grub_version in
+ grub) db_get grub-installer/bootdev || true ;;
+ grub2) db_get grub-installer/bootdev2 || true ;;
+ *) db_progress STOP ; exit 10 ;;
+ esac
bootdev=$RET
if echo "$bootdev" | grep -qv '('; then
mappedbootdev=$(mapdevfs "$bootdev") || true
@@ -543,6 +551,12 @@
update_mtab
+case $grub_vrsion in
+ grub) frgrubroot=$(($frbootpart - 1)) ;;
+ grub2) frgrubroot=$frbootpart ;;
+ *) exit 1 ;;
+esac
+
if [ -z "$frdisk" ]; then
# Install grub on each space separated disk in the list
diff -Nru grub-installer-1.35/rescue.d/80grub-reinstall grub-installer-1.35+nmu2/rescue.d/80grub-reinstall
--- grub-installer-1.35/rescue.d/80grub-reinstall 2006-09-23 22:23:38.000000000 +0900
+++ grub-installer-1.35+nmu2/rescue.d/80grub-reinstall 2008-10-19 11:57:34.000000000 +0900
@@ -7,14 +7,22 @@
db_progress START 0 2 grub-installer/progress/title
db_progress INFO grub-installer/progress/step_bootdev
-db_input critical grub-installer/bootdev
+if [ -f /target/boot/grub/menu.lst ]; then
+ db_input critical grub-installer/bootdev
+else
+ db_input critical grub-installer/bootdev2
+fi
if ! db_go; then
# back up to menu
db_progress STOP
exit 10
fi
-db_get grub-installer/bootdev
+if [ -f /target/boot/grub/menu.lst ]; then
+ db_get grub-installer/bootdev
+else
+ db_get grub-installer/bootdev2
+fi
bootdev="$RET"
if echo "$bootdev" | grep -qv '('; then
mappedbootdev="$(mapdevfs "$bootdev")" || true
diff -Nru grub-installer-1.35/rescue.d/80grub-reinstall.tst grub-installer-1.35+nmu2/rescue.d/80grub-reinstall.tst
--- grub-installer-1.35/rescue.d/80grub-reinstall.tst 2006-07-26 07:50:27.000000000 +0900
+++ grub-installer-1.35+nmu2/rescue.d/80grub-reinstall.tst 2008-10-19 11:52:18.000000000 +0900
@@ -1,2 +1,2 @@
#! /bin/sh -e
-[ -f /target/boot/grub/menu.lst ]
+[ -f /target/boot/grub/menu.lst ] || [ -f /target/boot/grub/grub.cfg ]
Reply to: