each build in a series will have a version number one higher then
the previous one.
+### Environment Variables
+
+`MKOSI_NSPAWN_EXECUTABLE`
+
+: Takes a path. If specified, mkosi will use this path as the systemd-nspawn
+ executable instead of the system installation of systemd-nspawn.
+
## Supported distributions
Images may be created containing installations of the
die,
install_grub,
is_rpm_distribution,
+ nspawn_executable,
nspawn_params_for_blockdev_access,
nspawn_rlimit_params,
patch_file,
def nspawn_knows_arg(arg: str) -> bool:
- return bytes("unrecognized option", "UTF-8") not in run(["systemd-nspawn", arg], stderr=PIPE, check=False).stderr
+ return bytes("unrecognized option", "UTF-8") not in run([nspawn_executable(), arg], stderr=PIPE, check=False).stderr
def run_build_script(args: MkosiArgs, root: Path, raw: Optional[BinaryIO]) -> None:
with_network = 1 if args.with_network is True else 0
cmdline = [
- "systemd-nspawn",
+ nspawn_executable(),
"--quiet",
target,
f"--uuid={args.machine_id}",
else:
target = f"--image={args.output}"
- cmdline = ["systemd-nspawn", "--quiet", target]
+ cmdline = [nspawn_executable(), "--quiet", target]
# Redirecting output correctly when not running directly from the terminal.
console_arg = f"--console={'interactive' if not pipe else 'pipe'}"
]
+def nspawn_executable() -> str:
+ return os.getenv("MKOSI_NSPAWN_EXECUTABLE", "systemd-nspawn")
+
+
def run_workspace_command(
args: MkosiArgs,
root: Path,
capture_stdout: bool = False,
) -> Optional[str]:
nspawn = [
- "systemd-nspawn",
+ nspawn_executable(),
"--quiet",
f"--directory={root}",
"--uuid=" + args.machine_id,