From: DaanDeMeyer Date: Tue, 30 Dec 2025 21:17:56 +0000 (+0100) Subject: Add support for locale-gen X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9829b9136f2f4f08e6aee8999e7345fd919838d2;p=thirdparty%2Fmkosi.git Add support for locale-gen If locales are configured in /etc/locale.gen, let's run locale-gen. --- diff --git a/mkosi/__init__.py b/mkosi/__init__.py index 310d09545..d23332750 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -3123,6 +3123,20 @@ def run_tmpfiles(context: Context) -> None: ) # fmt: skip +def run_locale_gen(context: Context) -> None: + if not (context.root / "etc/locale.gen").exists(): + return + + if all( + line.strip().startswith("#") or not line.strip() + for line in (context.root / "etc/locale.gen").read_text().splitlines() + ): + return + + with complete_step("Generating locales"): + run(["locale-gen"], sandbox=chroot_cmd(root=context.rootoptions)) + + def run_preset(context: Context) -> None: if ( context.config.overlay