]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
factory: populate /etc/locale.conf with systemd build-time setting
authorLuca BRUNO <luca.bruno@coreos.com>
Thu, 23 Dec 2021 11:01:07 +0000 (11:01 +0000)
committerLuca BRUNO <luca.bruno@coreos.com>
Thu, 23 Dec 2021 11:01:12 +0000 (11:01 +0000)
This adds /etc/locale.conf to the set of configuration files
populated by tmpfiles.d factory /etc handling.
In particular, the build-time locale configuration in systemd is
now wired to a /usr factory file, and installed to the system.
On boot, if other locale customization tools did not write
/etc/locale.conf on the system, the factory default file gets
copied to /etc by systemd-tmpfiles.
This is done in order to avoid skews between different system
components when no locale settings are configured. At that point,
systemd can safely act as the fallback owner of /etc/locale.conf.

factory/templates/locale.conf.in [new file with mode: 0644]
factory/templates/meson.build [new file with mode: 0644]
man/locale.conf.xml
meson.build
tmpfiles.d/etc.conf.in

diff --git a/factory/templates/locale.conf.in b/factory/templates/locale.conf.in
new file mode 100644 (file)
index 0000000..421fd56
--- /dev/null
@@ -0,0 +1 @@
+LANG="{{ SYSTEMD_DEFAULT_LOCALE }}"
diff --git a/factory/templates/meson.build b/factory/templates/meson.build
new file mode 100644 (file)
index 0000000..821f176
--- /dev/null
@@ -0,0 +1,11 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+
+factory_etc_dir = factorydir / 'etc'
+
+custom_target(
+        'locale.conf',
+        input : 'locale.conf.in',
+        output : 'locale.conf',
+        command : [meson_render_jinja2, config_h, '@INPUT@', '@OUTPUT@'],
+        install : true,
+        install_dir : factory_etc_dir)
index b24ad9cf2eb5a3c9a1fe31ca5fc0b123dff570fd..fe263fcfd845f5c4f19c2d5af68bd7c9596d64ec 100644 (file)
     might be checked for locale configuration as well, however only as
     fallback.</para>
 
-    <para><filename>/etc/locale.conf</filename> is usually created and updated
+    <para><filename>/etc/locale.conf</filename> can be updated
     using
     <citerefentry><refentrytitle>systemd-localed.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
     <citerefentry project='man-pages'><refentrytitle>localectl</refentrytitle><manvolnum>1</manvolnum></citerefentry>
     may be used to alter the settings in this file during runtime from
     the command line. Use
     <citerefentry><refentrytitle>systemd-firstboot</refentrytitle><manvolnum>1</manvolnum></citerefentry>
-    to initialize them on mounted (but not booted) system images.</para>
+    to customize them on mounted (but not booted) system images.</para>
   </refsect1>
 
   <refsect1>
index c0cbadecb1238bf1f0bc769c8375543a79d56b86..dc6cbf8a58f49c351885716f93fd4cc1b800edfb 100644 (file)
@@ -3707,6 +3707,7 @@ subdir('docs/var-log')
 
 install_subdir('factory/etc',
                install_dir : factorydir)
+subdir('factory/templates')
 
 if install_sysconfdir
         install_data('xorg/50-systemd-user.sh',
index ebdc699c2629765c67d00e0f6885dd121dc9633f..2fdd498da58575e9d50f17dd177335ade0720007 100644 (file)
@@ -12,6 +12,7 @@ L+ /etc/mtab - - - - ../proc/self/mounts
 {% if HAVE_SMACK_RUN_LABEL %}
 t /etc/mtab - - - - security.SMACK64=_
 {% endif %}
+C! /etc/locale.conf - - - -
 C! /etc/nsswitch.conf - - - -
 {% if HAVE_PAM %}
 C! /etc/pam.d - - - -