]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Use systemd-repart's new --offline argument
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 27 Jun 2023 14:04:58 +0000 (16:04 +0200)
committerJörg Behrmann <behrmann@physik.fu-berlin.de>
Tue, 27 Jun 2023 15:59:12 +0000 (17:59 +0200)
When building images, we never want to use loop devices, so use
--offline=yes in that case. When booting images, we know that
systemd-nspawn requires loop devices, so require them for
systemd-repart as well using --offline=no.

mkosi/__init__.py

index 85a703bbf0a02b9e6109f244c39e6bbeea7b833f..3972b0f22d0b82d04bb46924d2db1aa9a66f7dee 100644 (file)
@@ -1609,6 +1609,7 @@ def make_image(state: MkosiState, skip: Sequence[str] = [], split: bool = False)
         "--dry-run=no",
         "--json=pretty",
         "--no-pager",
+        "--offline=yes",
         "--root", state.root,
         state.staging / state.config.output_with_format,
     ]
@@ -1924,7 +1925,7 @@ def nspawn_knows_arg(arg: str) -> bool:
 
 
 def finalize_image(image: Path, *, size: str) -> None:
-    run(["systemd-repart", "--image", image, "--size", size, "--no-pager", "--dry-run=no", image])
+    run(["systemd-repart", "--image", image, "--size", size, "--no-pager", "--dry-run=no", "--offline=no", image])
 
 
 @contextlib.contextmanager