[PATCH 07/16] install: Handle distinct physical root/sysroot

Radek Vykydal rvykydal at redhat.com
Mon Jul 14 11:15:41 UTC 2014


From: Colin Walters <walters at verbum.org>

Recent changes introduced the ability to have distinct physical root
and sysroot.  In this case, because we run the bootloader binaries
inside the target, we need to ensure that e.g. /boot is mounted inside
that target root.

Note in this case, we also use a new Blivet API to update its
knowledge of the system root.

This patch also updates the storage write logic to note if
ksdata.ostreesetup.osname is set, because the storage will have to be
written after the packaging.

Resolves: rhbz#1113535
Port of rpmostreepayload patches from master
commit 0bbc9adf41b33062bbbfe478b3373a3404de21aa
---
 pyanaconda/install.py | 30 +++++++++++++++++++++++++++---
 1 file changed, 27 insertions(+), 3 deletions(-)

diff --git a/pyanaconda/install.py b/pyanaconda/install.py
index 8068bf0..68551cc 100644
--- a/pyanaconda/install.py
+++ b/pyanaconda/install.py
@@ -30,6 +30,7 @@ from pyanaconda import timezone
 from pyanaconda.i18n import _
 from pyanaconda.threads import threadMgr
 import logging
+import blivet
 log = logging.getLogger("anaconda")
 
 def _writeKS(ksdata):
@@ -148,7 +149,9 @@ def doInstall(storage, payload, ksdata, instClass):
     payload.preStorage()
 
     turnOnFilesystems(storage, mountOnly=flags.flags.dirInstall)
-    if not flags.flags.livecdInstall and not flags.flags.dirInstall:
+    write_storage_late = (flags.flags.livecdInstall or ksdata.ostreesetup.seen
+                          and not flags.flags.dirInstall)
+    if not write_storage_late:
         storage.write()
 
     # Do packaging.
@@ -169,8 +172,29 @@ def doInstall(storage, payload, ksdata, instClass):
     payload.preInstall(packages=packages, groups=payload.languageGroups())
     payload.install()
 
-    if flags.flags.livecdInstall:
-        storage.write()
+    if write_storage_late:
+        if iutil.getSysroot() != iutil.getTargetPhysicalRoot():
+            blivet.setSysroot(iutil.getTargetPhysicalRoot(),
+                              iutil.getSysroot())
+            storage.write()
+
+            # Now that we have the FS layout in the target, umount
+            # things that were in the legacy sysroot, and put them in
+            # the target root, except for the physical /.  First,
+            # unmount all target filesystems.
+            storage.umountFilesystems()
+
+            # Explicitly mount the root on the physical sysroot
+            rootmnt = storage.mountpoints.get('/')
+            rootmnt.setup()
+            rootmnt.format.setup(rootmnt.format.options, chroot=iutil.getTargetPhysicalRoot())
+
+            # Everything else goes in the target root, including /boot
+            # since the bootloader code will expect to find /boot
+            # inside the chroot.
+            storage.mountFilesystems(skipRoot=True)
+        else:
+            storage.write()
 
     # Do bootloader.
     if not flags.flags.dirInstall:
-- 
1.9.0



More information about the anaconda-patches mailing list