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

Proposed by Colin Watson
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 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
=== added directory 'check.d'
=== added file 'check.d/_numbers'
--- check.d/_numbers 1970-01-01 00:00:00 +0000
+++ check.d/_numbers 2012-03-20 17:10:22 +0000
@@ -0,0 +1,1 @@
108 biosgrub
02
=== added file 'check.d/biosgrub'
--- check.d/biosgrub 1970-01-01 00:00:00 +0000
+++ check.d/biosgrub 2012-03-20 17:10:22 +0000
@@ -0,0 +1,84 @@
1#! /bin/sh
2
3. /lib/partman/lib/base.sh
4
5# Keep this in sync with grub-installer.
6want_method=
7ARCH="$(archdetect)"
8case $ARCH in
9 i386/mac|amd64/mac)
10 if [ -d /sys/firmware/efi ]; then
11 want_method=efi
12 else
13 want_method=biosgrub
14 fi
15 ;;
16 i386/efi|amd64/efi)
17 want_method=efi
18 ;;
19 i386/*|amd64/*|*-i386/*|*-amd64/*)
20 want_method=biosgrub
21 ;;
22 *)
23 exit 0
24 ;;
25esac
26
27# Do all the disks on this system use GPT?
28found_gpt=no
29found_non_gpt=no
30for dev in $DEVICES/*; do
31 [ -d "$dev" ] || continue
32 cd "$dev"
33 open_dialog GET_LABEL_TYPE
34 read_line label_type
35 close_dialog
36 if [ "$label_type" = gpt ]; then
37 found_gpt=yes
38 else
39 found_non_gpt=yes
40 fi
41done
42if [ "$found_gpt" = no ] || [ "$found_non_gpt" = yes ]; then
43 # We might be intending to boot from one of the non-GPT disks.
44 exit 0
45fi
46
47# Is there at least one EFI System Partition or BIOS Boot Partition, as
48# appropriate?
49have_bootable=no
50for dev in $DEVICES/*; do
51 [ -d "$dev" ] || continue
52 cd "$dev"
53 partitions=
54 open_dialog PARTITIONS
55 while { read_line num id size type fs path name; [ "$id" ]; }; do
56 [ "$fs" != free ] || continue
57 partitions="$partitions $id,$num"
58 done
59 close_dialog
60
61 for part in $partitions; do
62 id="${part%,*}"
63 num="${part#*,}"
64 [ -f "$id/method" ] || continue
65 method="$(cat "$id/method")"
66 if [ "$method" = "$want_method" ]; then
67 have_bootable=yes
68 break
69 fi
70 done
71done
72
73if [ "$have_bootable" = no ]; then
74 template="partman-partitioning/no_bootable_gpt_$want_method"
75 db_set "$template" true
76 db_input critical "$template" || true
77 db_go || true
78 db_get "$template"
79 if [ "$RET" = true ]; then
80 exit 1
81 fi
82fi
83
84exit 0
085
=== modified file 'debian/changelog'
--- debian/changelog 2011-10-19 10:15:44 +0000
+++ debian/changelog 2012-03-20 17:10:22 +0000
@@ -1,3 +1,10 @@
1partman-partitioning (83ubuntu2) UNRELEASED; urgency=low
2
3 * On systems with only GPT disks, check that an EFI System Partition or a
4 BIOS Boot Partition exists, as appropriate (LP: #855871).
5
6 -- Colin Watson <cjwatson@ubuntu.com> Tue, 20 Mar 2012 15:24:58 +0000
7
1partman-partitioning (83ubuntu1) precise; urgency=low8partman-partitioning (83ubuntu1) precise; urgency=low
29
3 * Resynchronise with Debian. Remaining changes:10 * Resynchronise with Debian. Remaining changes:
411
=== modified file 'debian/di-numbers'
--- debian/di-numbers 2009-09-02 14:15:41 +0000
+++ debian/di-numbers 2012-03-20 17:10:22 +0000
@@ -4,3 +4,4 @@
4init.d lib/partman4init.d lib/partman
5update.d lib/partman5update.d lib/partman
6choose_method lib/partman6choose_method lib/partman
7check.d lib/partman
78
=== modified file 'debian/partman-partitioning.templates'
--- debian/partman-partitioning.templates 2009-09-02 14:18:47 +0000
+++ debian/partman-partitioning.templates 2012-03-20 17:10:22 +0000
@@ -277,3 +277,27 @@
277# Up to 10 character positions277# Up to 10 character positions
278_Description: biosgrub278_Description: biosgrub
279279
280Template: partman-partitioning/no_bootable_gpt_efi
281Type: boolean
282# :sl5:
283_Description: Go back to the menu and correct this problem?
284 The partition table format in use on your disks normally requires you to
285 create a separate "EFI boot partition" for boot loader code. Note that
286 this is not the same as a partition mounted on /boot.
287 .
288 If you do not go back to the partitioning menu and correct this error, boot
289 loader installation may fail later, although it may still be possible to
290 install the boot loader to a partition.
291
292Template: partman-partitioning/no_bootable_gpt_biosgrub
293Type: boolean
294# :sl5:
295_Description: Go back to the menu and correct this problem?
296 The partition table format in use on your disks normally requires you to
297 create a separate "Reserved BIOS boot area" for boot loader code. Note
298 that this is not the same as a partition mounted on /boot.
299 .
300 If you do not go back to the partitioning menu and correct this error, boot
301 loader installation may fail later, although it may still be possible to
302 install the boot loader to a partition.
303

Subscribers

People subscribed via source and target branches

to all changes: