[PATCH] use drivemap and UUIDs in grub-installer
Changelog:
[ Felix Zielcke ]
* Change the debhelper compat level to 7 and bump the build
dependecy.
* Replace deprecated `dh_clean -k' with `dh_prep'.
* Remove the lintian overrides, they're no longer needed.
* Add drivemap in the grub2 generated menuentry for grub2 for
Dos/Windows.
* Use UUIDs in the generated menuentrys for grub2.
drivemap is similar to grub-legacy's map command.
Don't wonder that I used 1.96+20090608-1 in the dpkg version comparison.
It doestn't exist yet in Debian.
Current sid version supports drivemap but doestn't understand partitions
instead of drives. This has been already fixed upstream but there's
still another bug for which a patch already exists upstream.
--
Felix Zielcke
Index: debian/control
===================================================================
--- debian/control (revision 58754)
+++ debian/control (working copy)
@@ -3,13 +3,13 @@ Section: debian-installer
Priority: standard
Maintainer: Debian Install System Team <debian-boot@lists.debian.org>
Uploaders: Joey Hess <joeyh@debian.org>, Otavio Salvador <otavio@debian.org>, Robert Millan <rmh@aybabtu.com>
-Build-Depends: debhelper (>= 4.2), po-debconf (>= 0.5.0)
+Build-Depends: debhelper (>= 7), po-debconf (>= 0.5.0)
Vcs-Svn: svn://svn.debian.org/d-i/trunk/packages/arch/i386/grub-installer
Package: grub-installer
Architecture: i386 hurd-i386 amd64 kfreebsd-i386 kfreebsd-amd64 powerpc
Provides: bootable-system
-Depends: cdebconf-udeb, kernel-installer, created-fstab, di-utils (>= 1.15), di-utils-mapdevfs, os-prober, partman-utils
+Depends: cdebconf-udeb, kernel-installer, created-fstab, di-utils (>= 1.15), di-utils-mapdevfs, os-prober
XB-Installer-Menu-Item: 7400
XC-Package-Type: udeb
Description: Install GRUB on a hard disk
Index: debian/compat
===================================================================
--- debian/compat (revision 58754)
+++ debian/compat (working copy)
@@ -1 +1 @@
-4
+7
Index: debian/changelog
===================================================================
--- debian/changelog (revision 58754)
+++ debian/changelog (working copy)
@@ -8,7 +8,16 @@ grub-installer (1.38) UNRELEASED; urgenc
[ Max Vozeler ]
* Use grub2 when ext4 is chosen (closes: #529363).
- -- Colin Watson <cjwatson@debian.org> Thu, 14 May 2009 13:08:03 +0100
+ [ Felix Zielcke ]
+ * Change the debhelper compat level to 7 and bump the build
+ dependecy.
+ * Replace deprecated `dh_clean -k' with `dh_prep'.
+ * Remove the lintian overrides, they're no longer needed.
+ * Add support for drivemap in the grub2 generated menuentry for
+ Dos/Windows.
+ * Use UUIDs in the grub2 generated menuentrys.
+
+ -- Felix Zielcke <fzielcke@z-51.de> Mon, 08 Jun 2009 17:08:05 +0200
grub-installer (1.37) unstable; urgency=low
Index: debian/rules
===================================================================
--- debian/rules (revision 58754)
+++ debian/rules (working copy)
@@ -11,7 +11,7 @@ clean:
install: build
dh_testdir
dh_testroot
- dh_clean -k
+ dh_prep
binary-arch: build install
dh_testdir
Index: debian/source.lintian-overrides
===================================================================
--- debian/source.lintian-overrides (revision 58754)
+++ debian/source.lintian-overrides (working copy)
@@ -1,2 +0,0 @@
-no-standards-version-field
-maintainer-script-lacks-debhelper-token
Index: grub-installer
===================================================================
--- grub-installer (revision 58754)
+++ grub-installer (working copy)
@@ -401,6 +401,8 @@ if ! apt-install $grub_package ; then
exit 1
fi
+grub_debian_version="$($chroot $ROOT dpkg-query -W -f '${Version}' $grub_package)"
+
if [ "$frtype" = multipath ]; then
$chroot $ROOT umount /proc
fi
@@ -756,6 +758,12 @@ fi
tmpfile=/tmp/menu.lst.extras
OLDIFS="$IFS"
IFS="$newline"
+
+no_floppy=""
+if $chroot $ROOT dpkg --compare-versions $grub_debian_version ge 1.96+20090608-1 ; then
+ no_floppy="--no-floppy"
+fi
+
for os in $(cat /tmp/os-probed); do
IFS="$OLDIFS"
title=$(echo "$os" | cut -d: -f2)
Index: otheros.sh
===================================================================
--- otheros.sh (revision 58754)
+++ otheros.sh (working copy)
@@ -35,12 +35,31 @@ EOF
} # grub_write_chain end
grub2_write_chain() {
+ uuid="$($chroot $ROOT grub-probe --target fs_uuid --device $partition)"
+
cat >> $tmpfile <<EOF
# This entry automatically added by the Debian installer for a non-linux OS
# on $partition
menuentry "$title" {
set root=$grubdrive
+EOF
+ if [ -n "$uuid" ] ; then
+ cat >> $tmpfile <<EOF
+ search $no_floppy --fs_uuid --set $uuid
+EOF
+ fi
+ # DOS/Windows can't deal with booting from a non-first hard drive
+ case $shortname in
+ MS*|Win*)
+ if $chroot $ROOT dpkg --compare-versions $grub_debian_version ge 1.96+20090608-1 ; then
+ cat >> $tmpfile <<EOF
+ drivemap -s (hd0) \$root
+EOF
+ fi
+ ;;
+ esac
+ cat >> $tmpfile <<EOF
chainloader +1
}
EOF
@@ -75,6 +94,14 @@ grub2_write_linux() {
# linux installation on $mappedpartition.
menuentry "$label (on $mappedpartition)" {
set root=$grubdrive
+EOF
+ uuid="$($chroot $ROOT grub-probe --target fs_uuid --device $partition)"
+ if [ -n "$uuid" ] ; then
+ cat >> $tmpfile <<EOF
+ search $no_floppy --fs_uuid --set $uuid
+EOF
+ fi
+ cat >> $tmpfile <<EOF
linux $kernel $params
EOF
if [ -n "$initrd" ]; then
@@ -116,6 +143,14 @@ grub2_write_hurd() {
# hurd installation on $partition.
menuentry "$title (on $partition)" {
set root=$grubdrive
+EOF
+ uuid="$($chroot $ROOT grub-probe --target fs_uuid --device $partition)"
+ if [ -n "$uuid" ] ; then
+ cat >> $tmpfile <<EOF
+ search $no_floppy --fs_uuid --set $uuid
+EOF
+ fi
+ cat >> $tmpfile <<EOF
multiboot /boot/gnumach.gz root=device:$hurddrive
module /hurd/ext2fs.static --readonly \\
--multiboot-command-line=\${kernel-command-line} \\
Reply to: