[blivet 1/2] Allow hfs+ boot devices to have their name set (#1010495)
Brian C. Lane
bcl at redhat.com
Tue Oct 29 23:56:57 UTC 2013
From: "Brian C. Lane" <bcl at redhat.com>
---
blivet/__init__.py | 71 +++++++++++++++++++++++++++---------------------------
1 file changed, 36 insertions(+), 35 deletions(-)
diff --git a/blivet/__init__.py b/blivet/__init__.py
index 8b572bd..a85e01a 100644
--- a/blivet/__init__.py
+++ b/blivet/__init__.py
@@ -326,44 +326,45 @@ class Blivet(object):
bootDevs = [boot]
for dev in bootDevs:
- if hasattr(dev, "bootable"):
- # Dos labels can only have one partition marked as active
- # and unmarking ie the windows partition is not a good idea
- skip = False
- if dev.disk.format.partedDisk.type == "msdos":
- for p in dev.disk.format.partedDisk.partitions:
- if p.type == parted.PARTITION_NORMAL and \
- p.getFlag(parted.PARTITION_BOOT):
- skip = True
- break
-
- # GPT labeled disks should only have bootable set on the
- # 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 != "efi":
- skip = True
-
- if skip:
- log.info("not setting boot flag on %s" % dev.name)
- continue
- # hfs+ partitions on gpt can't be marked bootable via
- # parted
- if dev.disk.format.partedDisk.type == "gpt" and \
- dev.format.type == "hfs+":
- log.info("not setting boot flag on hfs+ partition"
- " %s" % dev.name)
- continue
- log.info("setting boot flag on %s" % dev.name)
+ if not hasattr(dev, "bootable"):
+ log.info("Skipping %s, not bootable", dev)
+ continue
+
+ # Dos labels can only have one partition marked as active
+ # and unmarking ie the windows partition is not a good idea
+ skip = False
+ if dev.disk.format.partedDisk.type == "msdos":
+ for p in dev.disk.format.partedDisk.partitions:
+ if p.type == parted.PARTITION_NORMAL and \
+ p.getFlag(parted.PARTITION_BOOT):
+ skip = True
+ break
+
+ # GPT labeled disks should only have bootable set on the
+ # 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+"]:
+ skip = True
+
+ if skip:
+ log.info("Skipping %s", dev.name)
+ continue
+
+ # hfs+ partitions on gpt can't be marked bootable via parted
+ if dev.disk.format.partedDisk.type != "gpt" or \
+ dev.format.type != "hfs+":
+ log.info("setting boot flag on %s", dev.name)
dev.bootable = True
- # Set the boot partition's name on disk labels that support it
- if dev.partedPartition.disk.supportsFeature(parted.DISK_TYPE_PARTITION_NAME):
- ped_partition = dev.partedPartition.getPedPartition()
- ped_partition.set_name(dev.format.name)
+ # Set the boot partition's name on disk labels that support it
+ if dev.partedPartition.disk.supportsFeature(parted.DISK_TYPE_PARTITION_NAME):
+ ped_partition = dev.partedPartition.getPedPartition()
+ ped_partition.set_name(dev.format.name)
+ log.info("Setting label on %s to '%s'", dev, dev.format.name)
- dev.disk.setup()
- dev.disk.format.commitToDisk()
+ dev.disk.setup()
+ dev.disk.format.commitToDisk()
if flags.installer_mode:
self.dumpState("final")
--
1.8.3.1
More information about the anaconda-patches
mailing list