From: Jörg Behrmann Date: Thu, 29 Aug 2024 09:05:37 +0000 (+0200) Subject: Inline apivfs_script_cmd X-Git-Tag: v25~328^2 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=refs%2Fpull%2F2986%2Fhead;p=thirdparty%2Fmkosi.git Inline apivfs_script_cmd --- diff --git a/mkosi/installer/__init__.py b/mkosi/installer/__init__.py index 203be6877..8a5468f5c 100644 --- a/mkosi/installer/__init__.py +++ b/mkosi/installer/__init__.py @@ -6,7 +6,7 @@ from pathlib import Path from mkosi.config import Config, ConfigFeature, OutputFormat from mkosi.context import Context from mkosi.mounts import finalize_crypto_mounts -from mkosi.run import apivfs_options, apivfs_script_cmd, finalize_passwd_mounts, find_binary +from mkosi.run import apivfs_options, finalize_interpreter, finalize_passwd_mounts, find_binary from mkosi.tree import rmtree from mkosi.types import PathString from mkosi.util import flatten, startswith @@ -114,7 +114,15 @@ class PackageManager: @classmethod def apivfs_script_cmd(cls, context: Context) -> list[PathString]: - return apivfs_script_cmd(tools=bool(context.config.tools_tree), options=cls.options(root="/buildroot")) + return [ + finalize_interpreter(bool(context.config.tools_tree)), "-SI", "/sandbox.py", + "--bind", "/", "/", + "--same-dir", + "--bind", "/var/tmp", "/buildroot/var/tmp", + *apivfs_options(), + *cls.options(root="/buildroot"), + "--", + ] @classmethod def sandbox(cls, context: Context, *, apivfs: bool) -> AbstractContextManager[list[PathString]]: diff --git a/mkosi/run.py b/mkosi/run.py index e6d4852b4..904da2573 100644 --- a/mkosi/run.py +++ b/mkosi/run.py @@ -560,19 +560,6 @@ def apivfs_options(*, root: Path = Path("/buildroot")) -> list[PathString]: ] -def apivfs_script_cmd(*, tools: bool, options: Sequence[PathString] = ()) -> list[PathString]: - exe = Path(sys.executable) - return [ - "python3" if tools or not exe.is_relative_to("/usr") else exe, "-SI", "/sandbox.py", - "--bind", "/", "/", - "--same-dir", - "--bind", "/var/tmp", "/buildroot/var/tmp", - *apivfs_options(), - *options, - "--", - ] - - def chroot_options() -> list[PathString]: return [ # Let's always run as (fake) root when we chroot inside the image as tools executed within the image could