Merge ~juliank/grub/+git/ubuntu:fix-esp-debconf-migration into ~ubuntu-core-dev/grub/+git/ubuntu:ubuntu

Proposed by Julian Andres Klode
Status: Merged
Merged at revision: bb5e68e985b9fa5e31cc7b83f399077429d401d2
Proposed branch: ~juliank/grub/+git/ubuntu:fix-esp-debconf-migration
Merge into: ~ubuntu-core-dev/grub/+git/ubuntu:ubuntu
Diff against target: 95 lines (+33/-19)
3 files modified
debian/changelog (+8/-0)
debian/grub-multi-install (+25/-5)
debian/postinst.in (+0/-14)
Reviewer Review Type Date Requested Status
Julian Andres Klode Approve
Review via email: mp+382201@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Julian Andres Klode (juliank) wrote :

Meh, no bad comments about the plan

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index b2aa937..e8970f3 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,11 @@
6+grub2 (2.04-1ubuntu26) UNRELEASED; urgency=medium
7+
8+ * Move /boot/efi -> debconf migration into wrapper, so it runs everywhere
9+ (LP: #1872077)
10+ * Display disk name and size in the ESP selection dialog, instead of ???
11+
12+ -- Julian Andres Klode <juliank@ubuntu.com> Tue, 14 Apr 2020 11:57:34 +0200
13+
14 grub2 (2.04-1ubuntu25) focal; urgency=medium
15
16 [ Jean-Baptiste Lallement ]
17diff --git a/debian/grub-multi-install b/debian/grub-multi-install
18index ed66c1e..2414369 100755
19--- a/debian/grub-multi-install
20+++ b/debian/grub-multi-install
21@@ -239,17 +239,36 @@ usable_efi_system_partitions()
22 ###############################################################################
23 FALLBACK_MOUNTPOINT=/var/lib/grub/esp
24
25+# Initial install/upgrade from /boot/efi?
26+db_fget grub-efi/install_devices seen
27+seen="$RET"
28+
29 # Get configured value
30 question=grub-efi/install_devices
31 priority=high
32 db_get grub-efi/install_devices
33 valid=1
34-for device in $RET; do
35- if [ ! -e "${device%,}" ]; then
36- valid=0
37- break
38+
39+# We either migrate /boot/efi over, or we check if we have invalid devices
40+if [ -z "$RET" ] && [ "$seen" != "true" ]; then
41+ echo "Trying to migrate /boot/efi into esp config"
42+ esp="$(get_mounted_device /boot/efi)"
43+ if [ "$esp" ]; then
44+ esp="$(device_to_id "$esp")"
45 fi
46-done
47+ if [ "$esp" ]; then
48+ db_set grub-efi/install_devices "$esp"
49+ db_fset grub-efi/install_devices seen true
50+ RET="$esp"
51+ fi
52+else
53+ for device in $RET; do
54+ if [ ! -e "${device%,}" ]; then
55+ valid=0
56+ break
57+ fi
58+ done
59+fi
60
61 # If /boot/efi points to a device that's not in the list, trigger the
62 # install_devices_disks_changed prompt below, but add the device behind
63@@ -292,6 +311,7 @@ while :; do
64
65 for partition_pair in $partitions; do
66 partition_id="${partition_pair#*:}"
67+ device="${partition_id%%-part*}"
68 ids="${ids:+$ids, }$partition_id"
69 describe_efi_system_partition "$(readlink -f "$device")" "$(readlink -f "$partition_id")" "$partition_id" "$(get_mountpoint "${partition_pair%%:*}")"
70 RET="$(printf %s "$RET" | sed 's/,/\\,/g')"
71diff --git a/debian/postinst.in b/debian/postinst.in
72index fbca021..4e1dafa 100644
73--- a/debian/postinst.in
74+++ b/debian/postinst.in
75@@ -728,20 +728,6 @@ case "$1" in
76 fi
77 fi
78
79- # Backwards /boot/efi compatibility: Move /boot/efi into the debconf
80- # setting on upgrades and install.
81- db_get grub-efi/install_devices || true
82- if [ -z "$RET" ] && dpkg --compare-versions "$2" lt 2.04-1ubuntu24~; then
83- esp="$(get_mounted_device /boot/efi)"
84- if [ "$esp" ]; then
85- esp="$(device_to_id "$esp")"
86- fi
87- if [ "$esp" ]; then
88- db_set grub-efi/install_devices "$esp"
89- db_fset grub-efi/install_devices seen true
90- fi
91- fi
92-
93 case @PACKAGE@ in
94 grub-efi-ia32) target=i386-efi ;;
95 grub-efi-amd64) target=x86_64-efi ;;

Subscribers

People subscribed via source and target branches