[blivet 2/2] Add macefi format type (#1010495)

Brian C. Lane bcl at redhat.com
Tue Oct 29 23:56:58 UTC 2013


From: "Brian C. Lane" <bcl at redhat.com>

macefi is a hfs+ formatted fs mounted at /boot/efi and labeled with
'Linux HFS+ ESP'
---
 blivet/__init__.py     |  6 +++---
 blivet/devicetree.py   |  6 ++++++
 blivet/formats/fs.py   | 14 ++++++++++++++
 blivet/partitioning.py |  4 ++--
 blivet/platform.py     |  6 +++---
 5 files changed, 28 insertions(+), 8 deletions(-)

diff --git a/blivet/__init__.py b/blivet/__init__.py
index a85e01a..c9ac21b 100644
--- a/blivet/__init__.py
+++ b/blivet/__init__.py
@@ -344,7 +344,7 @@ class Blivet(object):
                 # EFI system partition (parted sets the EFI System GUID on
                 # GPT partitions with the boot flag)
                 if dev.disk.format.labelType == "gpt" and \
-                   dev.format.type not in ["efi", "hfs+"]:
+                   dev.format.type not in ["efi", "macefi"]:
                        skip = True
 
                 if skip:
@@ -353,7 +353,7 @@ class Blivet(object):
 
                 # hfs+ partitions on gpt can't be marked bootable via parted
                 if dev.disk.format.partedDisk.type != "gpt" or \
-                        dev.format.type != "hfs+":
+                        dev.format.type not in ["hfs+", "macefi"]:
                     log.info("setting boot flag on %s", dev.name)
                     dev.bootable = True
 
@@ -1868,7 +1868,7 @@ class Blivet(object):
             fstype = self.defaultBootFSType
         elif mountpoint == "/boot/efi":
             if arch.isMactel():
-                fstype = "hfs+"
+                fstype = "macefi"
             else:
                 fstype = "efi"
 
diff --git a/blivet/devicetree.py b/blivet/devicetree.py
index 5ce5a6b..0c9aaff 100644
--- a/blivet/devicetree.py
+++ b/blivet/devicetree.py
@@ -1677,6 +1677,12 @@ class DeviceTree(object):
                 efi = formats.getFormat("efi")
                 if efi.minSize <= device.size <= efi.maxSize:
                     args[0] = "efi"
+        elif format_type == "hfsplus":
+            if isinstance(device, PartitionDevice):
+                macefi = formats.getFormat("macefi")
+                if macefi.minSize <= device.size <= macefi.maxSize and \
+                   device.partedPartition.name == macefi.name:
+                    args[0] = "macefi"
         elif format_type == "hfs":
             # apple bootstrap magic
             if isinstance(device, PartitionDevice) and device.bootable:
diff --git a/blivet/formats/fs.py b/blivet/formats/fs.py
index 04270f0..fa68370 100644
--- a/blivet/formats/fs.py
+++ b/blivet/formats/fs.py
@@ -1272,6 +1272,20 @@ class HFSPlus(FS):
 register_device_format(HFSPlus)
 
 
+class MacEFIFS(HFSPlus):
+    _type = "macefi"
+    _name = "Linux HFS+ ESP"
+    _udevTypes = []
+    _minSize = 50
+
+    @property
+    def supported(self):
+        return (isinstance(platform.platform, platform.MacEFI) and
+                self.utilsAvailable)
+
+register_device_format(MacEFIFS)
+
+
 class NTFS(FS):
     """ ntfs filesystem. """
     _type = "ntfs"
diff --git a/blivet/partitioning.py b/blivet/partitioning.py
index 28e83e7..1109ead 100644
--- a/blivet/partitioning.py
+++ b/blivet/partitioning.py
@@ -133,14 +133,14 @@ def _schedulePartitions(storage, disks):
         if request.requiredSpace and request.requiredSpace > free:
             continue
 
-        elif request.fstype in ("prepboot", "efi", "hfs+") and \
+        elif request.fstype in ("prepboot", "efi", "macefi", "hfs+") and \
              (storage.bootloader.skip_bootloader or stage1_device):
             # there should never be a need for more than one of these
             # partitions, so skip them.
             log.info("skipping unneeded stage1 %s request" % request.fstype)
             log.debug(request)
 
-            if request.fstype == "efi" and stage1_device:
+            if request.fstype in ["efi", "macefi"] and stage1_device:
                 # Set the mountpoint for the existing EFI boot partition
                 stage1_device.format.mountpoint = "/boot/efi"
 
diff --git a/blivet/platform.py b/blivet/platform.py
index 185d82e..b6e8bb0 100644
--- a/blivet/platform.py
+++ b/blivet/platform.py
@@ -211,14 +211,14 @@ class EFI(Platform):
             return 0
 
 class MacEFI(EFI):
-    _boot_stage1_format_types = ["hfs+"]
+    _boot_stage1_format_types = ["macefi"]
     _boot_efi_description = N_("Apple EFI Boot Partition")
-    _non_linux_format_types = ["hfs+"]
+    _non_linux_format_types = ["macefi"]
     _packages = ["mactel-boot"]
 
     def setDefaultPartitioning(self):
         ret = Platform.setDefaultPartitioning(self)
-        ret.append(PartSpec(mountpoint="/boot/efi", fstype="hfs+", size=20,
+        ret.append(PartSpec(mountpoint="/boot/efi", fstype="macefi", size=20,
                             maxSize=200,
                             grow=True, weight=self.weight(mountpoint="/boot/efi")))
         return ret
-- 
1.8.3.1



More information about the anaconda-patches mailing list