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
This commit is contained in:
Luca Weiss 2025-05-23 11:40:04 +02:00 committed by Newbyte
parent 47be020c7a
commit f1a6f0034b
No known key found for this signature in database
GPG key ID: ACD854892B38D898

View file

@ -249,10 +249,12 @@ def prepare_tempdir() -> Path:
:returns: Path to a temporary directory for aportgen to work within. :returns: Path to a temporary directory for aportgen to work within.
""" """
# Prepare aportgen tempdir inside and outside of chroot # Prepare aportgen tempdir inside and outside of chroot
chroot = Chroot.native()
pmb.chroot.init(chroot)
tempdir = Path("/tmp/aportgen") tempdir = Path("/tmp/aportgen")
aportgen = get_context().config.work / "aportgen" aportgen = get_context().config.work / "aportgen"
pmb.chroot.root(["rm", "-rf", tempdir]) pmb.chroot.root(["rm", "-rf", tempdir], chroot)
pmb.helpers.run.user(["mkdir", "-p", aportgen, Chroot.native() / tempdir]) pmb.helpers.run.user(["mkdir", "-p", aportgen, chroot / tempdir])
return tempdir return tempdir