[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#491376: recipe for BIOS-based boot on gpt



Attached patch makes it generate the x86 variant dynamicaly at build time,
as requested by Jérémy on IRC.

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."
Index: debian/install-rc
===================================================================
--- debian/install-rc	(revision 54867)
+++ debian/install-rc	(working copy)
@@ -7,7 +7,23 @@
 
 install -d $partman/$1
 
-cp -r $1/* $partman/$1/
+# ARCH is exported from debian/rules
+case $1:${ARCH} in
+    recipes:i386|recipes:amd64)
+	# BIOS boot partition (GPT only)
+        for i in `cd recipes && echo *` ; do
+            sed '/::$/a\
+\
+1 1 1 free\
+	\$gptonly{ }\
+	\$primary{ }\
+	\$bios_boot{ } .' recipes/$i > $partman/recipes/$i ; \
+        done
+    ;;
+    *)
+        cp -r $1/* $partman/$1/
+    ;;
+esac
 
 # Remove any SVN dirs that were copied along
 rm -rf `find $partman/$1/ -name .svn`
Index: debian/rules
===================================================================
--- debian/rules	(revision 54867)
+++ debian/rules	(working copy)
@@ -2,7 +2,7 @@
 
 export PACKAGE = partman-auto
 
-ARCH=$(shell dpkg-architecture -qDEB_HOST_ARCH)
+export ARCH=$(shell dpkg-architecture -qDEB_HOST_ARCH)
 
 build:
 
Index: lib/recipes.sh
===================================================================
--- lib/recipes.sh	(revision 54867)
+++ lib/recipes.sh	(working copy)
@@ -90,9 +90,16 @@
 			shift; shift; shift; shift
 			line="$min $factor $max $fs $*"
 
+			open_dialog GET_LABEL_TYPE
+			read_line label_type
+			close_dialog
+
 			# Exclude partitions that have ...ignore set
 			if [ "$ignore" ] && [ "$(echo $line | grep "$ignore")" ]; then
 				:
+			# Exclude partitions that have gptonly set (except on GPT labels)
+			elif [ "$label_type" != "gpt" ] && [ "$label_type" != "unknown" ] && [ "$(echo $line | grep "gptonly")" ]; then
+				:
 			else
 				scheme="${scheme:+$scheme$NL}$line"
 			fi
@@ -201,6 +208,19 @@
 			write_line NO_MORE
 			close_dialog
 			;;
+		    \$bios_boot{)
+			while [ "$1" != '}' ] && [ "$1" ]; do
+				shift
+			done
+			open_dialog GET_FLAGS $id
+			flags=$(read_paragraph)
+			close_dialog
+			open_dialog SET_FLAGS $id
+			write_line "$flags"
+			write_line bios_grub
+			write_line NO_MORE
+			close_dialog
+			;;
 		    \$*{)
 			while [ "$1" != '}' ] && [ "$1" ]; do
 				shift

Reply to: