]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
mkosi: also bind mount /var/tmp for the build script 53/head
authorLennart Poettering <lennart@poettering.net>
Wed, 21 Dec 2016 00:16:39 +0000 (01:16 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 21 Dec 2016 00:20:02 +0000 (01:20 +0100)
This is a follow-up for efa2f8593f0adf1009a9b221b51fb2b5203ac81c, and
also ensures /var/tmp is writable during the main build script
invocation (in addition to the already patched "workspace" invocations).

mkosi

diff --git a/mkosi b/mkosi
index a3429c1eb25e89f451eb6b2b262f083a0142c2c5..18797c6ec363de2f1d3c7e8fb6e56a58b4862387 100755 (executable)
--- a/mkosi
+++ b/mkosi
@@ -606,19 +606,13 @@ DHCP=yes
 
 def run_workspace_command(args, workspace, *cmd, network=False, env={}):
 
-    var_tmp = os.path.join(workspace, "var-tmp")
-    try:
-        os.mkdir(var_tmp)
-    except FileExistsError:
-        pass
-
     cmdline = ["systemd-nspawn",
                '--quiet',
                "--directory=" + os.path.join(workspace, "root"),
                "--uuid=" + args.machine_id,
                "--as-pid2",
                "--register=no",
-               "--bind=" + var_tmp + ":/var/tmp" ]
+               "--bind=" + var_tmp(workspace) + ":/var/tmp" ]
 
     if not network:
         cmdline += ["--private-network"]
@@ -2290,6 +2284,16 @@ def build_image(args, workspace, run_build_script):
 
     return raw, tar, root_hash
 
+def var_tmp(workspace):
+
+    var_tmp = os.path.join(workspace, "var-tmp")
+    try:
+        os.mkdir(var_tmp)
+    except FileExistsError:
+        pass
+
+    return var_tmp
+
 def run_build_script(args, workspace, raw):
     if args.build_script is None:
         return
@@ -2308,6 +2312,7 @@ def run_build_script(args, workspace, raw):
                    "--private-network",
                    "--register=no",
                    "--bind", dest + ":/root/dest",
+                   "--bind=" + var_tmp(workspace) + ":/var/tmp",
                    "--setenv=WITH_DOCS=" + ("1" if args.with_docs else "0"),
                    "--setenv=DESTDIR=/root/dest"]