Merge lp:~cjwatson/partman-partitioning/gpt-boot-partition-855871 into lp:~ubuntu-core-dev/partman-partitioning/ubuntu

Proposed by Colin Watson on 2012-03-20
Status: Merged
Merged at revision: 913
Proposed branch: lp:~cjwatson/partman-partitioning/gpt-boot-partition-855871
Merge into: lp:~ubuntu-core-dev/partman-partitioning/ubuntu
Diff against target: 151 lines (+117/-0)
5 files modified
check.d/_numbers (+1/-0)
check.d/biosgrub (+84/-0)
debian/changelog (+7/-0)
debian/di-numbers (+1/-0)
debian/partman-partitioning.templates (+24/-0)
To merge this branch: bzr merge lp:~cjwatson/partman-partitioning/gpt-boot-partition-855871
Reviewer Review Type Date Requested Status
Ubuntu Core Development Team 2012-03-20 Pending
Review via email: mp+98460@code.launchpad.net

Description of the change

On systems with only GPT disks, check that an EFI System Partition or a BIOS Boot Partition exists, as appropriate (LP: #855871). This generally tries to prevent people from shooting themselves in the foot with manual partitioning on such systems (especially Intel Macs).

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'check.d'
2=== added file 'check.d/_numbers'
3--- check.d/_numbers 1970-01-01 00:00:00 +0000
4+++ check.d/_numbers 2012-03-20 17:10:22 +0000
5@@ -0,0 +1,1 @@
6+08 biosgrub
7
8=== added file 'check.d/biosgrub'
9--- check.d/biosgrub 1970-01-01 00:00:00 +0000
10+++ check.d/biosgrub 2012-03-20 17:10:22 +0000
11@@ -0,0 +1,84 @@
12+#! /bin/sh
13+
14+. /lib/partman/lib/base.sh
15+
16+# Keep this in sync with grub-installer.
17+want_method=
18+ARCH="$(archdetect)"
19+case $ARCH in
20+ i386/mac|amd64/mac)
21+ if [ -d /sys/firmware/efi ]; then
22+ want_method=efi
23+ else
24+ want_method=biosgrub
25+ fi
26+ ;;
27+ i386/efi|amd64/efi)
28+ want_method=efi
29+ ;;
30+ i386/*|amd64/*|*-i386/*|*-amd64/*)
31+ want_method=biosgrub
32+ ;;
33+ *)
34+ exit 0
35+ ;;
36+esac
37+
38+# Do all the disks on this system use GPT?
39+found_gpt=no
40+found_non_gpt=no
41+for dev in $DEVICES/*; do
42+ [ -d "$dev" ] || continue
43+ cd "$dev"
44+ open_dialog GET_LABEL_TYPE
45+ read_line label_type
46+ close_dialog
47+ if [ "$label_type" = gpt ]; then
48+ found_gpt=yes
49+ else
50+ found_non_gpt=yes
51+ fi
52+done
53+if [ "$found_gpt" = no ] || [ "$found_non_gpt" = yes ]; then
54+ # We might be intending to boot from one of the non-GPT disks.
55+ exit 0
56+fi
57+
58+# Is there at least one EFI System Partition or BIOS Boot Partition, as
59+# appropriate?
60+have_bootable=no
61+for dev in $DEVICES/*; do
62+ [ -d "$dev" ] || continue
63+ cd "$dev"
64+ partitions=
65+ open_dialog PARTITIONS
66+ while { read_line num id size type fs path name; [ "$id" ]; }; do
67+ [ "$fs" != free ] || continue
68+ partitions="$partitions $id,$num"
69+ done
70+ close_dialog
71+
72+ for part in $partitions; do
73+ id="${part%,*}"
74+ num="${part#*,}"
75+ [ -f "$id/method" ] || continue
76+ method="$(cat "$id/method")"
77+ if [ "$method" = "$want_method" ]; then
78+ have_bootable=yes
79+ break
80+ fi
81+ done
82+done
83+
84+if [ "$have_bootable" = no ]; then
85+ template="partman-partitioning/no_bootable_gpt_$want_method"
86+ db_set "$template" true
87+ db_input critical "$template" || true
88+ db_go || true
89+ db_get "$template"
90+ if [ "$RET" = true ]; then
91+ exit 1
92+ fi
93+fi
94+
95+exit 0
96
97=== modified file 'debian/changelog'
98--- debian/changelog 2011-10-19 10:15:44 +0000
99+++ debian/changelog 2012-03-20 17:10:22 +0000
100@@ -1,3 +1,10 @@
101+partman-partitioning (83ubuntu2) UNRELEASED; urgency=low
102+
103+ * On systems with only GPT disks, check that an EFI System Partition or a
104+ BIOS Boot Partition exists, as appropriate (LP: #855871).
105+
106+ -- Colin Watson <cjwatson@ubuntu.com> Tue, 20 Mar 2012 15:24:58 +0000
107+
108 partman-partitioning (83ubuntu1) precise; urgency=low
109
110 * Resynchronise with Debian. Remaining changes:
111
112=== modified file 'debian/di-numbers'
113--- debian/di-numbers 2009-09-02 14:15:41 +0000
114+++ debian/di-numbers 2012-03-20 17:10:22 +0000
115@@ -4,3 +4,4 @@
116 init.d lib/partman
117 update.d lib/partman
118 choose_method lib/partman
119+check.d lib/partman
120
121=== modified file 'debian/partman-partitioning.templates'
122--- debian/partman-partitioning.templates 2009-09-02 14:18:47 +0000
123+++ debian/partman-partitioning.templates 2012-03-20 17:10:22 +0000
124@@ -277,3 +277,27 @@
125 # Up to 10 character positions
126 _Description: biosgrub
127
128+Template: partman-partitioning/no_bootable_gpt_efi
129+Type: boolean
130+# :sl5:
131+_Description: Go back to the menu and correct this problem?
132+ The partition table format in use on your disks normally requires you to
133+ create a separate "EFI boot partition" for boot loader code. Note that
134+ this is not the same as a partition mounted on /boot.
135+ .
136+ If you do not go back to the partitioning menu and correct this error, boot
137+ loader installation may fail later, although it may still be possible to
138+ install the boot loader to a partition.
139+
140+Template: partman-partitioning/no_bootable_gpt_biosgrub
141+Type: boolean
142+# :sl5:
143+_Description: Go back to the menu and correct this problem?
144+ The partition table format in use on your disks normally requires you to
145+ create a separate "Reserved BIOS boot area" for boot loader code. Note
146+ that this is not the same as a partition mounted on /boot.
147+ .
148+ If you do not go back to the partitioning menu and correct this error, boot
149+ loader installation may fail later, although it may still be possible to
150+ install the boot loader to a partition.
151+

Subscribers

People subscribed via source and target branches

to all changes: