]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Move debian/ubuntu locale symlink logic to install function
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 15 Jul 2022 20:04:36 +0000 (22:04 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 28 Jul 2022 14:55:53 +0000 (16:55 +0200)
Let's get rid of another distribution check by simply creating the
symlink in the install function.

mkosi/__init__.py

index 6890334d344a5c6d7f0befda4a05839f3a01e5b8..81e023eb69482418864b66a6d5159805859c54dd 100644 (file)
@@ -1640,15 +1640,6 @@ def install_etc_locale(args: MkosiArgs, root: Path, cached: bool) -> None:
     # Let's ensure we use a UTF-8 locale everywhere.
     etc_locale.write_text("LANG=C.UTF-8\n")
 
-    # Debian/Ubuntu use a different path to store the locale so let's make sure that path is a symlink to
-    # etc/locale.conf.
-    if args.distribution in (Distribution.debian, Distribution.ubuntu):
-        try:
-            root.joinpath("etc/default/locale").unlink()
-        except FileNotFoundError:
-            pass
-        root.joinpath("etc/default/locale").symlink_to("../locale.conf")
-
 
 def install_etc_hostname(args: MkosiArgs, root: Path, cached: bool) -> None:
     if cached:
@@ -2717,6 +2708,14 @@ def install_debian_or_ubuntu(args: MkosiArgs, root: Path, *, do_run_build_script
     write_resource(root / "etc/kernel/install.d/50-mkosi-dpkg-reconfigure-dracut.install",
                    "mkosi.resources", "dpkg-reconfigure-dracut.install", executable=True)
 
+    # Debian/Ubuntu use a different path to store the locale so let's make sure that path is a symlink to
+    # etc/locale.conf.
+    try:
+        root.joinpath("etc/default/locale").unlink()
+    except FileNotFoundError:
+        pass
+    root.joinpath("etc/default/locale").symlink_to("../locale.conf")
+
 
 @complete_step("Installing Debian…")
 def install_debian(args: MkosiArgs, root: Path, do_run_build_script: bool) -> None: