[rhel7 2/3] Correctly generate rescue initrd (#1019970)

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


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

This solves a couple issues:
 * we should not be copying the machine-id from the live image
 * The live image shouldn't have rescue images, skip copying them
 * call rpmposttrans to generate the rescue image. This has to be done
   before the bootloader config is written.

Related: rhbz#1019970
---
 pyanaconda/packaging/__init__.py    |  3 ---
 pyanaconda/packaging/livepayload.py | 10 +++++++++-
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/pyanaconda/packaging/__init__.py b/pyanaconda/packaging/__init__.py
index fb3ca1a..f0453c5 100644
--- a/pyanaconda/packaging/__init__.py
+++ b/pyanaconda/packaging/__init__.py
@@ -601,9 +601,6 @@ class Payload(object):
                                         kernel],
                                         root=ROOT_PATH)
 
-            iutil.execWithRedirect("new-kernel-pkg",
-                                   ["--rpmposttrans", kernel],
-                                   root=ROOT_PATH)
         self._createdInitrds = True
 
 
diff --git a/pyanaconda/packaging/livepayload.py b/pyanaconda/packaging/livepayload.py
index 217deab..9c2f264 100644
--- a/pyanaconda/packaging/livepayload.py
+++ b/pyanaconda/packaging/livepayload.py
@@ -117,7 +117,8 @@ class LiveImagePayload(ImagePayload):
         # go recursively, include devices and special files, don't cross
         # file system boundaries
         args = ["-pogAXtlHrDx", "--exclude", "/dev/", "--exclude", "/proc/",
-                "--exclude", "/sys/", "--exclude", "/run/", INSTALL_TREE+"/", ROOT_PATH]
+                "--exclude", "/sys/", "--exclude", "/run/", "--exclude", "/boot/*rescue*",
+                "--exclude", "/etc/machine-id", INSTALL_TREE+"/", ROOT_PATH]
         try:
             rc = iutil.execWithRedirect(cmd, args)
         except (OSError, RuntimeError) as e:
@@ -146,6 +147,13 @@ class LiveImagePayload(ImagePayload):
 
         super(LiveImagePayload, self).postInstall()
 
+        # Live needs to create the rescue image before bootloader is written
+        for kernel in self.kernelVersionList:
+            log.info("Generating rescue image for %s", kernel)
+            iutil.execWithRedirect("new-kernel-pkg",
+                                   ["--rpmposttrans", kernel],
+                                   root=ROOT_PATH)
+
     @property
     def spaceRequired(self):
         return Size(bytes=iutil.getDirSize("/")*1024)
-- 
1.8.3.1



More information about the anaconda-patches mailing list