]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Bind mount /work into chroot instead of individual files/directories
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 8 Jan 2024 19:01:33 +0000 (20:01 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 8 Jan 2024 19:43:30 +0000 (20:43 +0100)
Same effect with less code.

mkosi/__init__.py

index 1ca597e7a4dfbd8d08231c03f1df48e01aaa0716..66a138ea4a599f049ca05a2829a5d6954492d4d9 100644 (file)
@@ -444,9 +444,7 @@ def run_prepare_scripts(context: Context, build: bool) -> None:
                 resolve=True,
                 tools=context.config.tools(),
                 options=[
-                    "--bind", "/work/prepare", "/work/prepare",
-                    "--bind", "/work/src", "/work/src",
-                    "--bind", "/work/scripts", "/work/scripts",
+                    "--bind", "/work", "/work",
                     "--chdir", "/work/src",
                     "--setenv", "BUILDROOT", "/",
                 ],
@@ -521,16 +519,7 @@ def run_build_scripts(context: Context) -> None:
                 resolve=context.config.with_network,
                 tools=context.config.tools(),
                 options=[
-                    "--bind", "/work/build-script", "/work/build-script",
-                    "--bind", "/work/dest", "/work/dest",
-                    "--bind", "/work/out", "/work/out",
-                    "--bind", "/work/src", "/work/src",
-                    "--bind", "/work/scripts", "/work/scripts",
-                    *(
-                        ["--bind", "/work/build", "/work/build"]
-                        if context.config.build_dir
-                        else []
-                    ),
+                    "--bind", "/work", "/work",
                     "--chdir", "/work/src",
                     "--setenv", "BUILDROOT", "/",
                     *(["--setenv", "BUILDDIR", "/work/build"] if context.config.build_dir else []),
@@ -600,10 +589,7 @@ def run_postinst_scripts(context: Context) -> None:
                 resolve=context.config.with_network,
                 tools=context.config.tools(),
                 options=[
-                    "--bind", "/work/postinst", "/work/postinst",
-                    "--bind", "/work/out", "/work/out",
-                    "--bind", "/work/src", "/work/src",
-                    "--bind", "/work/scripts", "/work/scripts",
+                    "--bind", "/work", "/work",
                     "--chdir", "/work/src",
                     "--setenv", "BUILDROOT", "/",
                 ],
@@ -664,10 +650,7 @@ def run_finalize_scripts(context: Context) -> None:
                 resolve=context.config.with_network,
                 tools=context.config.tools(),
                 options=[
-                    "--bind", "/work/finalize", "/work/finalize",
-                    "--bind", "/work/out", "/work/out",
-                    "--bind", "/work/src", "/work/src",
-                    "--bind", "/work/scripts", "/work/scripts",
+                    "--bind", "/work", "/work",
                     "--chdir", "/work/src",
                     "--setenv", "BUILDROOT", "/",
                 ],