You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
qubes-installer-qubes-os/blivet/0001-Fix-detection-of-macef...

48 lines
2.0 KiB

From d08d99dfb766e539b9e0074643ab3bc940d6fcee Mon Sep 17 00:00:00 2001
From: Adam Williamson <awilliam@redhat.com>
Date: Thu, 10 Nov 2016 11:34:24 -0800
Subject: [PATCH] Fix detection of 'macefi' partitions (#1393846)
368a4db6 lost a crucial condition in the detection of 'macefi'
partitions in the transition to the 'populator helper' design.
Previously we checked that the parted partition 'name' (which
is a GPT property, for GPT partitions) matched the expected
value according to the macefi format, which basically means we
will only detect partitions created by a previous anaconda run
as 'macefi' (because that name is a very specific one which is
only created by anaconda in the first place).
In the transition, that condition was lost, and now we treat
any device with an HFS+ filesystem that's over 50MiB in size
as a 'macefi' device, which means we mount it at /boot/efi and
try to write all kinds of stuff to it. Not surprisingly, this
borks the install. Fortunately, HFS+ filesystems are mounted
read-only unless they have journalling disabled, so this won't
result in us messing up people's OS X partitions with any luck.
---
blivet/populator/helpers/boot.py | 10 ++++++++++
tests/populator_test.py | 33 +++++++++++++++++++++++++++++++++
2 files changed, 43 insertions(+)
diff --git a/blivet/populator/helpers/boot.py b/blivet/populator/helpers/boot.py
index b679b3b..3d80dd2 100644
--- a/blivet/populator/helpers/boot.py
+++ b/blivet/populator/helpers/boot.py
@@ -54,6 +54,16 @@ class MacEFIFormatPopulator(BootFormatPopulator):
_type_specifier = "macefi"
_base_type_specifier = "hfsplus"
+ @classmethod
+ def match(cls, data, device):
+ fmt = formats.get_format(cls._type_specifier)
+ try:
+ return (super().match(data, device) and
+ device.parted_partition.name == fmt.name)
+ except AttributeError:
+ # just in case device.parted_partition has no name attr
+ return False
+
class AppleBootFormatPopulator(BootFormatPopulator):
_type_specifier = "appleboot"