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

[PATCH 1/4] Don't allow /boot on logical partition except for grub.



Related: rhbz#725418
---
 pyanaconda/bootloader.py |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/pyanaconda/bootloader.py b/pyanaconda/bootloader.py
index 45905d1..db0626f 100644
--- a/pyanaconda/bootloader.py
+++ b/pyanaconda/bootloader.py
@@ -242,6 +242,7 @@ class BootLoader(object):
     stage2_format_types = ["ext4", "ext3", "ext2"]
     stage2_mountpoints = ["/boot", "/"]
     stage2_bootable = False
+    stage2_must_be_primary = True
     stage2_description = N_("/boot filesystem")
     stage2_max_end_mb = 2 * 1024 * 1024
 
@@ -568,6 +569,15 @@ class BootLoader(object):
         log.debug("_is_valid_location(%s) returning %s" % (device.name,ret))
         return ret
 
+    def _is_valid_partition(self, device, primary=None, desc=""):
+        ret = True
+        if device.type == "partition" and primary and not device.isPrimary:
+            self.errors.append(_("%s must be on a primary partition.") % desc)
+            ret = False
+
+        log.debug("_is_valid_partition(%s) returning %s" % (device.name,ret))
+        return ret
+
     #
     # target/stage1 device access
     #
@@ -766,6 +776,10 @@ class BootLoader(object):
                                        desc=self.stage2_description):
             valid = False
 
+        if not self._is_valid_partition(device,
+                                        primary=self.stage2_must_be_primary):
+            valid = False
+
         if not self._is_valid_md(device, device_types=self.stage2_device_types,
                                  raid_levels=self.stage2_raid_levels,
                                  metadata=self.stage2_raid_metadata,
@@ -1100,6 +1114,7 @@ class GRUB(BootLoader):
 
     stage2_is_valid_stage1 = True
     stage2_bootable = True
+    stage2_must_be_primary = False
 
     # list of strings representing options for boot device types
     stage2_device_types = ["partition", "mdarray"]
-- 
1.7.7.6


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