[rhel7 1/3] Always regenerate initramfs (#1019970)

Brian C. Lane bcl at redhat.com
Fri Oct 18 22:03:20 UTC 2013


From: "Brian C. Lane" <bcl at redhat.com>

dracut depends on some of the configuration settings we write out in
doConfiguration so we need to always regenerate the initramfs for the
system after we write these.

Resolves: rhbz#1019970
---
 pyanaconda/install.py               |  7 +++++--
 pyanaconda/packaging/__init__.py    | 14 ++++++++++----
 pyanaconda/packaging/livepayload.py |  1 -
 3 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/pyanaconda/install.py b/pyanaconda/install.py
index f1ad21f..c8181a3 100644
--- a/pyanaconda/install.py
+++ b/pyanaconda/install.py
@@ -52,12 +52,12 @@ def _writeKS(ksdata):
 def doConfiguration(storage, payload, ksdata, instClass):
     from pyanaconda.kickstart import runPostScripts
 
-    step_count = 5
+    step_count = 6
     # if a realm was discovered,
     # increment the counter as the
     # real joining step will be executed
     if ksdata.realm.discovered:
-        step_count = 6
+        step_count += 1
     progressQ.send_init(step_count)
 
     # Now run the execute methods of ksdata that require an installed system
@@ -89,6 +89,9 @@ def doConfiguration(storage, payload, ksdata, instClass):
         ksdata.addons.execute(storage, ksdata, instClass, u)
         ksdata.configured_spokes.execute(storage, ksdata, instClass, u)
 
+    with progress_report(_("Generating initramfs")):
+        payload.recreateInitrds(force=True)
+
     if ksdata.realm.discovered:
         with progress_report(_("Joining realm: %s") % ksdata.realm.discovered):
             ksdata.realm.execute(storage, ksdata, instClass)
diff --git a/pyanaconda/packaging/__init__.py b/pyanaconda/packaging/__init__.py
index 95150cf..fb3ca1a 100644
--- a/pyanaconda/packaging/__init__.py
+++ b/pyanaconda/packaging/__init__.py
@@ -571,10 +571,16 @@ class Payload(object):
                 # XXX TODO: real error handling, as this is probably going to
                 #           prevent boot on some systems
 
-        if new_firmware:
-            self._recreateInitrds()
+    def recreateInitrds(self, force=False):
+        """ Recreate the initrds by calling new-kernel-pkg
 
-    def _recreateInitrds(self, force=False):
+            This needs to be done after all configuration files have been
+            written, since dracut depends on some of them.
+
+            :param force: Always recreate, default is to only do it on first call
+            :type force: bool
+            :returns: None
+        """
         if not force and self._createdInitrds:
             return
 
@@ -583,7 +589,7 @@ class Payload(object):
             if not flags.imageInstall:
                 iutil.execWithRedirect("new-kernel-pkg",
                                        ["--mkinitrd", "--dracut",
-                                        "--depmod", "--install", kernel],
+                                        "--depmod", "--update", kernel],
                                        root=ROOT_PATH)
             else:
                 # hostonly is not sensible for disk image installations
diff --git a/pyanaconda/packaging/livepayload.py b/pyanaconda/packaging/livepayload.py
index b9a4814..217deab 100644
--- a/pyanaconda/packaging/livepayload.py
+++ b/pyanaconda/packaging/livepayload.py
@@ -145,7 +145,6 @@ class LiveImagePayload(ImagePayload):
         blivet.util.umount(INSTALL_TREE)
 
         super(LiveImagePayload, self).postInstall()
-        self._recreateInitrds()
 
     @property
     def spaceRequired(self):
-- 
1.8.3.1



More information about the anaconda-patches mailing list