Hi,

Reasonably simple changes here, again heavily inspired by Ubuntu
code. One extra issue I found - it looks like /sys and /proc need to
be mounted in /target when we run the postinst, otherwise we'll fail
to drive efibootmgr. I've added code to do that here, but I'm not sure
it's the right way to do it - better suggestions welcome!

Depends on the libdebian-installer patch to add the "efi" subarch.

-- 
Steve McIntyre, Cambridge, UK.                                st...@einval.com
"Because heaters aren't purple!" -- Catherine Pitt
mr diff: /home/steve/debian/d-i/d-i/packages/grub-installer
diff --git a/debian/changelog b/debian/changelog
index 979eddd..0d857fb 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,13 @@
+grub-installer (1.78) unstable; urgency=low
+
+  [ Steve McIntyre ]
+  * Allow grub for amd64/efi and i386/efi, installing grub-efi instead of
+    grub-pc.
+  * Make sure that we have /sys and /proc mounted in /target in the
+    postinst, so that efibootmgr will work ok.
+
+ -- Steve McIntyre <93...@debian.org>  Tue, 21 Aug 2012 22:10:40 +0100
+
 grub-installer (1.77) unstable; urgency=low
 
   [ Cyril Brulebois ]
diff --git a/debian/isinstallable b/debian/isinstallable
index e66bac1..c404929 100755
--- a/debian/isinstallable
+++ b/debian/isinstallable
@@ -8,13 +8,6 @@ log() {
 ARCH="$(archdetect)"
 
 case $ARCH in
-    i386/mac|amd64/mac)
-	# Note: depends on partman-efi to load the efivars module!
-	if [ -d /sys/firmware/efi ]; then
-		log "GRUB not yet usable on Intel-based Macs booted using EFI"
-		exit 1
-	fi
-	;;
     powerpc/chrp_pegasos)
 	;;
     powerpc/*)
diff --git a/debian/postinst b/debian/postinst
index b32a1d0..5e001f1 100755
--- a/debian/postinst
+++ b/debian/postinst
@@ -1,2 +1,8 @@
 #! /bin/sh -e
+
+# If we're installing grub-efi, it wants /sys mounted in the
+# target. Maybe /proc too?
+mount -t sysfs sys /target/sys || true
+mount -t proc procfs /target/proc || true
+
 grub-installer /target
diff --git a/grub-installer b/grub-installer
index a0a4d8c..e9f350e 100755
--- a/grub-installer
+++ b/grub-installer
@@ -312,11 +312,16 @@ case $ARCH in
 	if [ -d /sys/firmware/efi ]; then
 		# This point can't be reached (yet).  See debian/isinstallable.
 		grub_package="grub-efi"
-		experimental_arch
 	else
 		grub_package="grub-pc"
 	fi
 	;;
+    i386/efi|amd64/efi)
+	grub_package="grub-efi"
+	;;
+    i386/*|amd64/*)
+	grub_package="grub-pc"
+	;;
     powerpc/*)
 	grub_package="grub-ieee1275"
 	experimental_arch
@@ -409,10 +414,13 @@ db_progress INFO grub-installer/progress/step_install
 # to grub legacy, or vice-versa
 case "$grub_package" in
     grub)
-	log-output -t grub-installer $chroot $ROOT dpkg -P grub-pc-bin grub-pc
+	log-output -t grub-installer $chroot $ROOT dpkg -P grub-pc-bin grub-pc grub-efi grub-efi-amd64-bin grub-efi-amd64 grub-efi-ia32-bin grub-efi-ia32 grub-gfxpayload-lists
 	;;
     grub-pc)
-	log-output -t grub-installer $chroot $ROOT dpkg -P grub grub-legacy
+	log-output -t grub-installer $chroot $ROOT dpkg -P grub grub-legacy grub-efi grub-efi-amd64-bin grub-efi-amd64 grub-efi-ia32-bin grub-efi-ia32
+    ;;
+    grub-efi)
+	log-output -t grub-installer $chroot $ROOT dpkg -P grub grub-legacy grub-pc-bin grub-pc grub-gfxpayload-lists
 	;;
 esac
 
@@ -662,7 +670,7 @@ if [ -z "$frdisk" ]; then
 
 		CODE=0
 		case $ARCH:$grub_package in
-		    *:grub|*:grub-pc|sparc:grub-ieee1275)
+		    *:grub|*:grub-pc|*:grub-efi|sparc:grub-ieee1275)
 			info "Running $chroot $ROOT grub-install $grub_install_params \"$bootdev\""
 			log-output -t grub-installer $chroot $ROOT grub-install $grub_install_params "$bootdev" || CODE=$?
 			;;
@@ -675,7 +683,7 @@ if [ -z "$frdisk" ]; then
 			info "grub-install ran successfully"
 		else
 			case $ARCH:$grub_package in
-			    *:grub|*:grub-pc|sparc:grub-ieee1275)
+			    *:grub|*:grub-pc|*:grub-efi|sparc:grub-ieee1275)
 				error "Running 'grub-install $grub_install_params \"$bootdev\"' failed."
 				;;
 			    *)
@@ -962,7 +970,7 @@ if [ "$serial" ] ; then
 		) >$ROOT/boot/grub/$menu_file.new
 		mv $ROOT/boot/grub/$menu_file.new $ROOT/boot/grub/$menu_file
 		;;
-	    grub-pc)
+	    grub-pc|grub-efi)
 		if grep -q "^GRUB_TERMINAL=" $ROOT/etc/default/grub; then
 			sed -i $ROOT/etc/default/grub -e "s/^\(GRUB_TERMINAL\)=.*/\1=serial/g"
 		else

mr diff: finished (1 ok)

Reply via email to