]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Use workdir() in make_image() 3031/head
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Sun, 15 Sep 2024 20:28:55 +0000 (22:28 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 16 Sep 2024 07:08:19 +0000 (09:08 +0200)
mkosi/__init__.py

index 16041edd784d0d54991748523d10f02df74b3017..6737b792db732cc537531f619f2656c903c5b124 100644 (file)
@@ -2667,13 +2667,13 @@ def make_image(
         "--no-pager",
         f"--offline={yes_no(context.config.repart_offline)}",
         "--seed", str(context.config.seed),
-        context.staging / context.config.output_with_format,
+        workdir(context.staging / context.config.output_with_format),
     ]
     options: list[PathString] = [
         # Make sure we're root so that the mkfs tools invoked by systemd-repart think the files
         # that go into the disk image are owned by root.
         "--become-root",
-        "--bind", context.staging, context.staging,
+        "--bind", context.staging, workdir(context.staging),
     ]
 
     if root:
@@ -2684,17 +2684,18 @@ def make_image(
     if not (context.staging / context.config.output_with_format).exists():
         cmdline += ["--empty=create"]
     if context.config.passphrase:
-        cmdline += ["--key-file", context.config.passphrase]
-        options += ["--ro-bind", context.config.passphrase, context.config.passphrase]
+        cmdline += ["--key-file", workdir(context.config.passphrase)]
+        options += ["--ro-bind", context.config.passphrase, workdir(context.config.passphrase)]
     if context.config.verity_key:
-        cmdline += ["--private-key", context.config.verity_key]
+        key = workdir(context.config.verity_key) if context.config.verity_key.exists() else context.config.verity_key
+        cmdline += ["--private-key", str(key)]
         if context.config.verity_key_source.type != KeySourceType.file:
             cmdline += ["--private-key-source", str(context.config.verity_key_source)]
         if context.config.verity_key.exists():
-            options += ["--ro-bind", context.config.verity_key, context.config.verity_key]
+            options += ["--ro-bind", context.config.verity_key, workdir(context.config.verity_key)]
     if context.config.verity_certificate:
-        cmdline += ["--certificate", context.config.verity_certificate]
-        options += ["--ro-bind", context.config.verity_certificate, context.config.verity_certificate]
+        cmdline += ["--certificate", workdir(context.config.verity_certificate)]
+        options += ["--ro-bind", context.config.verity_certificate, workdir(context.config.verity_certificate)]
     if skip:
         cmdline += ["--defer-partitions", ",".join(skip)]
     if split:
@@ -2708,8 +2709,8 @@ def make_image(
         ]
 
     for d in definitions:
-        cmdline += ["--definitions", d]
-        options += ["--ro-bind", d, d]
+        cmdline += ["--definitions", workdir(d)]
+        options += ["--ro-bind", d, workdir(d)]
 
     with complete_step(msg):
         output = json.loads(