From f1a6f0034b9818cd735a602639538c841cf0b38e Mon Sep 17 00:00:00 2001 From: Luca Weiss Date: Fri, 23 May 2025 11:40:04 +0200 Subject: [PATCH] pmb.aportgen.core: Initialize chroot properly Make sure to initialize the native chroot before trying to run a command in it. Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2610 --- pmb/aportgen/core.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pmb/aportgen/core.py b/pmb/aportgen/core.py index 486fd5bd..13a44b3a 100644 --- a/pmb/aportgen/core.py +++ b/pmb/aportgen/core.py @@ -249,10 +249,12 @@ def prepare_tempdir() -> Path: :returns: Path to a temporary directory for aportgen to work within. """ # Prepare aportgen tempdir inside and outside of chroot + chroot = Chroot.native() + pmb.chroot.init(chroot) tempdir = Path("/tmp/aportgen") aportgen = get_context().config.work / "aportgen" - pmb.chroot.root(["rm", "-rf", tempdir]) - pmb.helpers.run.user(["mkdir", "-p", aportgen, Chroot.native() / tempdir]) + pmb.chroot.root(["rm", "-rf", tempdir], chroot) + pmb.helpers.run.user(["mkdir", "-p", aportgen, chroot / tempdir]) return tempdir