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
is_centos_variant,
is_epel_variant,
is_rpm_distribution,
- nspawn_executable,
nspawn_knows_arg,
nspawn_rlimit_params,
nspawn_version,
with_network = 1 if state.config.with_network is True else 0
cmdline = [
- nspawn_executable(),
+ "systemd-nspawn",
"--quiet",
target,
f"--machine=mkosi-{uuid.uuid4().hex}",
else:
target = f"--image={config.output}"
- cmdline = [nspawn_executable(), "--quiet", target]
+ cmdline = ["systemd-nspawn", "--quiet", target]
if config.read_only:
cmdline += ["--read-only"]
def nspawn_knows_arg(arg: str) -> bool:
# Specify some extra incompatible options so nspawn doesn't try to boot a container in the current
# directory if it has a compatible layout.
- return "unrecognized option" not in run([nspawn_executable(), arg,
+ return "unrecognized option" not in run(["systemd-nspawn", arg,
"--directory", "/dev/null", "--image", "/dev/null"],
stdout=subprocess.DEVNULL, stderr=subprocess.PIPE, check=False,
text=True).stderr
] if nspawn_knows_arg("--rlimit") else []
-def nspawn_executable() -> str:
- return os.getenv("MKOSI_NSPAWN_EXECUTABLE", "systemd-nspawn")
-
-
def nspawn_version() -> int:
- return int(run([nspawn_executable(), "--version"], stdout=subprocess.PIPE).stdout.strip().split()[1])
+ return int(run(["systemd-nspawn", "--version"], stdout=subprocess.PIPE).stdout.strip().split()[1])
def run_workspace_command(
check: bool = True,
) -> CompletedProcess:
nspawn = [
- nspawn_executable(),
+ "systemd-nspawn",
"--quiet",
f"--directory={state.root}",
"--machine=mkosi-" + uuid.uuid4().hex,