[PATCH] Only allow one EFI System Partition to exist at a time.

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

 



We previously had code to do this that didn't work; it is
also removed in this patch.

Resolves: rhbz#593984
---
 pyanaconda/platform.py             |   23 ++++++++++++-----------
 pyanaconda/storage/devicetree.py   |    2 +-
 pyanaconda/storage/partitioning.py |    3 ++-
 3 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/pyanaconda/platform.py b/pyanaconda/platform.py
index fcc1c92..59c68b3 100644
--- a/pyanaconda/platform.py
+++ b/pyanaconda/platform.py
@@ -210,8 +210,15 @@ class EFI(Platform):
     _maxBootPartSize = 256
 
     def bootDevice(self):
-        mntDict = self._mntDict()
-        return mntDict.get("/boot/efi")
+        bootDev = None
+
+        for part in self.anaconda.id.storage.partitions:
+            if part.format.type == "efi" and self.validBootPartSize(part.size):
+                bootDev = part
+                # if we're only picking one, it might as well be the first
+                break
+
+        return bootDev
 
     def bootloaderChoices(self, bl):
         bootDev = self.bootDevice()
@@ -249,7 +256,7 @@ class EFI(Platform):
             partitions = filter(lambda d: d.type == "partition", req.parents)
 
         # Check that we've got a correct disk label.
-        for p in partitions:        
+        for p in partitions:
             partedDisk = p.disk.format.partedDisk
             labelType = self.diskLabelType(partedDisk.device.type)
             # Allow using gpt with x86, but not msdos with EFI
@@ -261,14 +268,8 @@ class EFI(Platform):
 
     def setDefaultPartitioning(self):
         ret = Platform.setDefaultPartitioning(self)
-
-        # Only add the EFI partition to the default set if there's not already
-        # one on the system.
-        if len(filter(lambda dev: dev.format.type == "efi" and self.validBootPartSize(dev.size),
-                      self.anaconda.storage.partitions)) == 0:
-            ret.append(PartSpec(mountpoint="/boot/efi", fstype="efi", size=20,
-                                maxSize=200, grow=True, weight=self.weight(fstype="efi")))
-
+        ret.append(PartSpec(mountpoint="/boot/efi", fstype="efi", size=20,
+                            maxSize=200, grow=True, weight=self.weight(fstype="efi")))
         return ret
 
     def weight(self, fstype=None, mountpoint=None):
diff --git a/pyanaconda/storage/devicetree.py b/pyanaconda/storage/devicetree.py
index 0a8449f..cbf6a04 100644
--- a/pyanaconda/storage/devicetree.py
+++ b/pyanaconda/storage/devicetree.py
@@ -1500,7 +1500,7 @@ class DeviceTree(object):
                 kwargs["peStart"] = udev_device_get_pv_pe_start(info)
             except KeyError:
                 log.debug("PV %s has no pe_start" % name)
-        elif format_type == "vfat":
+        elif format_type == "vfat" or format_type == "efi":
             # efi magic
             if isinstance(device, PartitionDevice) and device.bootable:
                 efi = formats.getFormat("efi")
diff --git a/pyanaconda/storage/partitioning.py b/pyanaconda/storage/partitioning.py
index 2c6f30a..87a7749 100644
--- a/pyanaconda/storage/partitioning.py
+++ b/pyanaconda/storage/partitioning.py
@@ -93,7 +93,8 @@ def _schedulePartitions(anaconda, disks):
 
         if request.fstype is None:
             request.fstype = anaconda.storage.defaultFSType
-        elif request.fstype == "prepboot" and anaconda.platform.bootDevice():
+        elif request.fstype in ("prepboot", "efi") and \
+                anaconda.platform.bootDevice():
             # there should never be a need for more than one PReP partition
             continue
 
-- 
1.7.3.1

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux