From: Daan De Meyer Date: Thu, 20 Jul 2023 09:34:39 +0000 (+0200) Subject: Only execute preset, hwdb, sysusers tools if they are available X-Git-Tag: v15~72^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cf4ff379f2c36239bba262e53c7d5b9fae8825e1;p=thirdparty%2Fmkosi.git Only execute preset, hwdb, sysusers tools if they are available Let's reduce the number of dependencies needed to create a tools tree by only executing these tools if they are installed on the system. --- diff --git a/mkosi/__init__.py b/mkosi/__init__.py index 7b372c538..570b150c5 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -1499,16 +1499,28 @@ def run_depmod(state: MkosiState) -> None: def run_sysusers(state: MkosiState) -> None: + if not shutil.which("systemd-sysusers"): + logging.info("systemd-sysusers is not installed, not generating system users") + return + with complete_step("Generating system users"): run(["systemd-sysusers", "--root", state.root]) def run_preset(state: MkosiState) -> None: + if not shutil.which("systemctl"): + logging.info("systemctl is not installed, not applying presets") + return + with complete_step("Applying presets…"): run(["systemctl", "--root", state.root, "preset-all"]) def run_hwdb(state: MkosiState) -> None: + if not shutil.which("systemd-hwdb"): + logging.info("systemd-hwdb is not installed, not generating hwdb") + return + with complete_step("Generating hardware database"): run(["systemd-hwdb", "--root", state.root, "--usr", "--strict", "update"])