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

Re: [PATCH 5/6] Do not set boot flag when there is already a partition with the flag (#533658)



On 11/25/2009 03:59 PM, Hans de Goede wrote:
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 533658, 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()

I don't see how this is a part of the big patch. But it looks good to me.


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