avij / rpms / anaconda

Forked from rpms/anaconda 5 years ago
Clone

Blame SOURCES/0008-install-Handle-distinct-physical-root-sysroot.patch

fbcaed
From cbcd5de3b4a37b620388f1de420721d1ae3d4130 Mon Sep 17 00:00:00 2001
fbcaed
From: Colin Walters <walters@verbum.org>
fbcaed
Date: Fri, 25 Apr 2014 08:57:47 -0400
fbcaed
Subject: [PATCH 08/20] install: Handle distinct physical root/sysroot
fbcaed
fbcaed
Recent changes introduced the ability to have distinct physical root
fbcaed
and sysroot.  In this case, because we run the bootloader binaries
fbcaed
inside the target, we need to ensure that e.g. /boot is mounted inside
fbcaed
that target root.
fbcaed
fbcaed
Note in this case, we also use a new Blivet API to update its
fbcaed
knowledge of the system root.
fbcaed
fbcaed
This patch also updates the storage write logic to note if
fbcaed
ksdata.ostreesetup.osname is set, because the storage will have to be
fbcaed
written after the packaging.
fbcaed
fbcaed
Resolves: rhbz#1113535
fbcaed
Port of rpmostreepayload patches from master
fbcaed
commit 0bbc9adf41b33062bbbfe478b3373a3404de21aa
fbcaed
---
fbcaed
 pyanaconda/install.py | 30 +++++++++++++++++++++++++++---
fbcaed
 1 file changed, 27 insertions(+), 3 deletions(-)
fbcaed
fbcaed
diff --git a/pyanaconda/install.py b/pyanaconda/install.py
fbcaed
index 8068bf0..68551cc 100644
fbcaed
--- a/pyanaconda/install.py
fbcaed
+++ b/pyanaconda/install.py
fbcaed
@@ -30,6 +30,7 @@ from pyanaconda import timezone
fbcaed
 from pyanaconda.i18n import _
fbcaed
 from pyanaconda.threads import threadMgr
fbcaed
 import logging
fbcaed
+import blivet
fbcaed
 log = logging.getLogger("anaconda")
fbcaed
 
fbcaed
 def _writeKS(ksdata):
fbcaed
@@ -148,7 +149,9 @@ def doInstall(storage, payload, ksdata, instClass):
fbcaed
     payload.preStorage()
fbcaed
 
fbcaed
     turnOnFilesystems(storage, mountOnly=flags.flags.dirInstall)
fbcaed
-    if not flags.flags.livecdInstall and not flags.flags.dirInstall:
fbcaed
+    write_storage_late = (flags.flags.livecdInstall or ksdata.ostreesetup.seen
fbcaed
+                          and not flags.flags.dirInstall)
fbcaed
+    if not write_storage_late:
fbcaed
         storage.write()
fbcaed
 
fbcaed
     # Do packaging.
fbcaed
@@ -169,8 +172,29 @@ def doInstall(storage, payload, ksdata, instClass):
fbcaed
     payload.preInstall(packages=packages, groups=payload.languageGroups())
fbcaed
     payload.install()
fbcaed
 
fbcaed
-    if flags.flags.livecdInstall:
fbcaed
-        storage.write()
fbcaed
+    if write_storage_late:
fbcaed
+        if iutil.getSysroot() != iutil.getTargetPhysicalRoot():
fbcaed
+            blivet.setSysroot(iutil.getTargetPhysicalRoot(),
fbcaed
+                              iutil.getSysroot())
fbcaed
+            storage.write()
fbcaed
+
fbcaed
+            # Now that we have the FS layout in the target, umount
fbcaed
+            # things that were in the legacy sysroot, and put them in
fbcaed
+            # the target root, except for the physical /.  First,
fbcaed
+            # unmount all target filesystems.
fbcaed
+            storage.umountFilesystems()
fbcaed
+
fbcaed
+            # Explicitly mount the root on the physical sysroot
fbcaed
+            rootmnt = storage.mountpoints.get('/')
fbcaed
+            rootmnt.setup()
fbcaed
+            rootmnt.format.setup(rootmnt.format.options, chroot=iutil.getTargetPhysicalRoot())
fbcaed
+
fbcaed
+            # Everything else goes in the target root, including /boot
fbcaed
+            # since the bootloader code will expect to find /boot
fbcaed
+            # inside the chroot.
fbcaed
+            storage.mountFilesystems(skipRoot=True)
fbcaed
+        else:
fbcaed
+            storage.write()
fbcaed
 
fbcaed
     # Do bootloader.
fbcaed
     if not flags.flags.dirInstall:
fbcaed
-- 
fbcaed
1.9.3
fbcaed