At the cost of adding a dependency on parted, this will at least
detect GPT and abort.

"Doing it right" would require a dependency on gdisk, plus parsing
/etc/default/extlinux to find the root partition, and then setting the
"legacy BIOS bootable" flag.  Would you like me to write that?

Otherwise this can just be explained in the (nonexistent) README.GPT
file I mention in the error message.

-- 
Eric Cooper             e c c @ c m u . e d u
>From 1cf3540ce497d15a8054b366bd620603b0df0809 Mon Sep 17 00:00:00 2001
From: Eric Cooper <[email protected]>
Date: Mon, 20 Jun 2011 21:16:47 -0400
Subject: [PATCH] Detect GPT partitions and abort installation


Signed-off-by: Eric Cooper <[email protected]>
---
 debian/local/extlinux-install |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/debian/local/extlinux-install b/debian/local/extlinux-install
index 007d5a4..a1538ff 100755
--- a/debian/local/extlinux-install
+++ b/debian/local/extlinux-install
@@ -36,6 +36,21 @@ then
 	exit 1
 fi
 
+_PART_TYPE=$(parted "${_DEVICE}" print | sed -n '/^Partition Table:/{s/^.*: //;p;q}')
+case "${_PART_TYPE}" in
+	msdos)
+		;;
+	gpt)
+		echo "E: GUID partition table detected"
+		echo Please see /usr/share/doc/extlinux/README.GPT for instructions"
+		exit 1
+		;;
+	*)
+		echo "E: unknown partition table type (${_PART_TYPE})"
+		exit 1
+		;;
+esac
+
 # Checking extlinux directory
 echo -n "P: Checking for EXTLINUX directory..."
 
-- 
1.7.5.3

Reply via email to