Fix bootimg_analyze error (MR 2339)

Fix error:
rm: can't remove '/tmp/bootimg_parser': No such file or directory

Fixes #2379
This commit is contained in:
Anri Dellal 2024-06-29 02:30:27 +03:00 committed by Oliver Smith
parent 3a9284da8a
commit 0c932c273d
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
2 changed files with 2 additions and 17 deletions

View file

@ -3,7 +3,6 @@
import os
from pmb.core.context import get_context
from pmb.helpers import logging
from pathlib import Path
import pmb.chroot.apk
from pmb.types import PmbArgs
import pmb.install
@ -35,21 +34,6 @@ def kernel_flavor_installed(chroot: Chroot, autoinstall=True):
return glob_result[0].name if glob_result else None
# FIXME: this function has ONE user, does it need to exist?
def tempfolder(path: Path, chroot: Chroot = Chroot.native()):
"""
Create a temporary folder inside the chroot that belongs to "user".
The folder gets deleted, if it already exists.
:param path: of the temporary folder inside the chroot
:returns: the path
"""
if chroot / path:
pmb.chroot.root(["rm", "-r", path])
pmb.chroot.user(["mkdir", "-p", path])
return path
def copy_xauthority(args: PmbArgs):
"""
Copy the host system's Xauthority file to the pmos user inside the chroot,

View file

@ -84,7 +84,8 @@ def bootimg(path: Path):
)
pmb.chroot.apk.install(["file", "unpackbootimg"], Chroot.native())
temp_path = pmb.chroot.other.tempfolder(Path("/tmp/bootimg_parser"))
temp_path = Path("/tmp/bootimg_parser")
pmb.chroot.user(["mkdir", "-p", temp_path])
bootimg_path = Chroot.native() / temp_path / "boot.img"
# Copy the boot.img into the chroot temporary folder