diff --git a/pyanaconda/packaging/__init__.py b/pyanaconda/packaging/__init__.py index 5e4e147fb5d..53437e5b2c4 100644 --- a/pyanaconda/packaging/__init__.py +++ b/pyanaconda/packaging/__init__.py @@ -636,29 +636,11 @@ def writeStorageLate(self): every payload except for dnf. Payloads should only implement one of these methods by overriding the unneeded one with a pass. """ - if not flags.dirInstall: - if iutil.getSysroot() != iutil.getTargetPhysicalRoot(): - set_sysroot(iutil.getTargetPhysicalRoot(), iutil.getSysroot()) - - # 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. - self.storage.umount_filesystems() - - # Explicitly mount the root on the physical sysroot - rootmnt = self.storage.mountpoints.get('/') - rootmnt.setup() - rootmnt.format.setup(options=rootmnt.format.options, chroot=iutil.getTargetPhysicalRoot()) - - self.prepareMountTargets(self.storage) - - # Everything else goes in the target root, including /boot - # since the bootloader code will expect to find /boot - # inside the chroot. - self.storage.mount_filesystems(skip_root=True) - - self.storage.write() + if iutil.getSysroot() != iutil.getTargetPhysicalRoot(): + set_sysroot(iutil.getTargetPhysicalRoot(), iutil.getSysroot()) + self.prepareMountTargets(self.storage) + if not flags.dirInstall: + self.storage.write() # Inherit abstract methods from Payload # pylint: disable=abstract-method diff --git a/pyanaconda/packaging/rpmostreepayload.py b/pyanaconda/packaging/rpmostreepayload.py index 9f214c60afb..22f3efcc748 100644 --- a/pyanaconda/packaging/rpmostreepayload.py +++ b/pyanaconda/packaging/rpmostreepayload.py @@ -227,15 +227,21 @@ def install(self): mainctx.pop_thread_default() def prepareMountTargets(self, storage): + """ Prepare the ostree root """ ostreesetup = self.data.ostreesetup varroot = iutil.getTargetPhysicalRoot() + '/ostree/deploy/' + ostreesetup.osname + '/var' # Set up bind mounts as if we've booted the target system, so # that %post script work inside the target. - binds = [(varroot, - iutil.getSysroot() + '/var'), - (iutil.getSysroot() + '/usr', None)] + binds = [(varroot, iutil.getSysroot() + '/var'), + (iutil.getSysroot() + '/usr', None), + (iutil.getTargetPhysicalRoot(), iutil.getSysroot() + "/sysroot"), + (iutil.getTargetPhysicalRoot() + "/boot", iutil.getSysroot() + "/boot")] + + # Bind mount the other filesystems from /mnt/sysimage to the ostree root + for path in ["/dev", "/dev/pts", "/dev/shm", "/proc", "/run", "/sys", "/sys/fs/selinux"]: + binds += [(iutil.getTargetPhysicalRoot()+path, iutil.getSysroot()+path)] for (src, dest) in binds: self._safeExecWithRedirect("mount", @@ -245,15 +251,6 @@ def prepareMountTargets(self, storage): self._safeExecWithRedirect("mount", ["--bind", "-o", "remount,ro", src, src]) - # We previously bind mounted /mnt/sysimage to - # /mnt/sysimage/.../sysroot, but this caused issues with mount - # path canonicalization. Instead, directly mount the physical - # device at two different paths. - dest = iutil.getSysroot() + "/sysroot" - self._safeExecWithRedirect("mount", - [storage.root_device.format.device, dest]) - self._internal_mounts.append(dest) - # Now, ensure that all other potential mount point directories such as # (/home) are created. We run through the full tmpfiles here in order # to also allow Anaconda and %post scripts to write to directories like