[PATCH 03/11] Honor kickstart bootloader --location=none. (#871143)

David Lehman dlehman at redhat.com
Fri Nov 9 21:09:13 UTC 2012


---
 pyanaconda/bootloader.py           |   22 ++++++++++++++++++----
 pyanaconda/kickstart.py            |    1 +
 pyanaconda/storage/__init__.py     |    6 +++++-
 pyanaconda/storage/partitioning.py |    7 ++++---
 4 files changed, 28 insertions(+), 8 deletions(-)

diff --git a/pyanaconda/bootloader.py b/pyanaconda/bootloader.py
index 8fa3f8b..34040fe 100644
--- a/pyanaconda/bootloader.py
+++ b/pyanaconda/bootloader.py
@@ -934,6 +934,9 @@ class BootLoader(object):
     #
     def write(self):
         """ Write the bootloader configuration and install the bootloader. """
+        if self.skip_bootloader:
+            return
+
         if self.update_only:
             self.update()
             return
@@ -1532,6 +1535,9 @@ class GRUB2(GRUB):
 
     def write(self):
         """ Write the bootloader configuration and install the bootloader. """
+        if self.skip_bootloader:
+            return
+
         if self.update_only:
             self.update()
             return
@@ -1631,6 +1637,9 @@ class EFIGRUB(GRUB2):
     #
     def write(self):
         """ Write the bootloader configuration and install the bootloader. """
+        if self.skip_bootloader:
+            return
+
         if self.update_only:
             self.update()
             return
@@ -2157,10 +2166,11 @@ def writeBootLoader(storage, payload, instClass):
     """
     from pyanaconda.errors import errorHandler, ERROR_RAISE
 
-    stage1_device = storage.bootloader.stage1_device
-    log.info("bootloader stage1 target device is %s" % stage1_device.name)
-    stage2_device = storage.bootloader.stage2_device
-    log.info("bootloader stage2 target device is %s" % stage2_device.name)
+    if not storage.bootloader.skip_bootloader:
+        stage1_device = storage.bootloader.stage1_device
+        log.info("bootloader stage1 target device is %s" % stage1_device.name)
+        stage2_device = storage.bootloader.stage2_device
+        log.info("bootloader stage2 target device is %s" % stage2_device.name)
 
     # get a list of installed kernel packages
     kernel_versions = payload.kernelVersionList
@@ -2187,6 +2197,10 @@ def writeBootLoader(storage, payload, instClass):
     # write out /etc/sysconfig/kernel
     writeSysconfigKernel(storage, version)
 
+    if storage.bootloader.skip_bootloader:
+        log.info("skipping bootloader install per user request")
+        return
+
     # now add an image for each of the other kernels
     for version in kernel_versions:
         label = "%s-%s" % (base_label, version)
diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index 2600c65..7823354 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -281,6 +281,7 @@ class Bootloader(commands.bootloader.F18_Bootloader):
             storage.bootloader.update_only = True
 
         if not location:
+            storage.bootloader.skip_bootloader = True
             return
 
         if self.appendLine:
diff --git a/pyanaconda/storage/__init__.py b/pyanaconda/storage/__init__.py
index 5c00143..e71be35 100644
--- a/pyanaconda/storage/__init__.py
+++ b/pyanaconda/storage/__init__.py
@@ -1510,7 +1510,7 @@ class Storage(object):
             warnings.append(_("Installing on a FireWire device.  This may "
                               "or may not produce a working system."))
 
-        if self.data and self.data.bootloader.location is not None:
+        if self.bootloader and not self.bootloader.skip_bootloader:
             stage1 = self.bootloader.stage1_device
             if not stage1:
                 errors.append(_("you have not created a bootloader stage1 "
@@ -1671,6 +1671,10 @@ class Storage(object):
             log.warning("either ksdata or bootloader data missing")
             return
 
+        if self.bootloader.skip_bootloader:
+            log.info("user specified that bootloader install be skipped")
+            return
+
         self.bootloader.stage1_disk = self.devicetree.resolveDevice(self.data.bootloader.bootDrive)
         self.bootloader.stage2_device = self.bootDevice
         try:
diff --git a/pyanaconda/storage/partitioning.py b/pyanaconda/storage/partitioning.py
index 9d70bd2..8e784ee 100644
--- a/pyanaconda/storage/partitioning.py
+++ b/pyanaconda/storage/partitioning.py
@@ -133,7 +133,7 @@ def _schedulePartitions(storage, disks):
             continue
 
         elif request.fstype in ("prepboot", "efi", "hfs+") and \
-             stage1_device:
+             (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)
@@ -152,8 +152,9 @@ def _schedulePartitions(storage, disks):
                              any([p.format.type == "biosboot"
                                     for p in storage.partitions
                                         if p.disk == stage1_device]))
-            if not (stage1_device and stage1_device.isDisk and
-                    is_gpt and not has_bios_boot):
+            if (storage.bootloader.skip_bootloader or
+                not (stage1_device and stage1_device.isDisk and
+                    is_gpt and not has_bios_boot)):
                 # 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)
-- 
1.7.7.6



More information about the anaconda-patches mailing list