is_epel_variant,
is_rpm_distribution,
nspawn_executable,
+ nspawn_knows_arg,
nspawn_params_for_blockdev_access,
nspawn_rlimit_params,
nspawn_version,
return args.install_dir or workspace(root).joinpath("dest")
-def nspawn_knows_arg(arg: str) -> bool:
- 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:
if args.build_script is None:
return
return p
+def nspawn_knows_arg(arg: str) -> bool:
+ return "unrecognized option" not in run([nspawn_executable(), arg], stderr=subprocess.PIPE, check=False, text=True).stderr
+
+
def nspawn_params_for_blockdev_access(args: MkosiArgs, loopdev: Path) -> List[str]:
assert args.partition_table is not None
def nspawn_rlimit_params() -> Sequence[str]:
return [
f"--rlimit=RLIMIT_CORE={format_rlimit(resource.RLIMIT_CORE)}",
- ]
+ ] if nspawn_knows_arg("--rlimit") else []
def nspawn_executable() -> str: