[PATCH] Do not set boot flag when there is already a partition with the flag

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

 



In F-10 and before we did not set the boot flag for /boot on msdos labels,
this could lead to issues when asked to install grub into a partition,
or with certain BIOS's which won't boot from a disk when there are no
active partitions on the disk. However our new behavior of always setting
the boot flag for /boot is wrong for msdos labels too, and is causing various
issues, see (amongst others) bug 530894 and:
http://forums.fedoraforum.org/showthread.php?t=231421
http://forums.fedoraforum.org/showthread.php?t=2348
---
 storage/__init__.py |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/storage/__init__.py b/storage/__init__.py
index b3da135..ea89633 100644
--- a/storage/__init__.py
+++ b/storage/__init__.py
@@ -291,6 +291,19 @@ class Storage(object):
         else:
             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
+                    if skip:
+                         log.info("not setting boot flag on %s as there is"
+                                  "another active partition" % dev.name)
+                         continue
                     log.info("setting boot flag on %s" % dev.name)
                     dev.bootable = True
                     dev.disk.setup()
-- 
1.6.5.2

_______________________________________________
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