From 623370e643e228449f5e49c0d82e6e423ae0e0f7 Mon Sep 17 00:00:00 2001 From: Luca BRUNO Date: Thu, 23 Dec 2021 11:01:07 +0000 Subject: [PATCH] factory: populate /etc/locale.conf with systemd build-time setting 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 | 1 + factory/templates/meson.build | 11 +++++++++++ man/locale.conf.xml | 4 ++-- meson.build | 1 + tmpfiles.d/etc.conf.in | 1 + 5 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 factory/templates/locale.conf.in create mode 100644 factory/templates/meson.build diff --git a/factory/templates/locale.conf.in b/factory/templates/locale.conf.in new file mode 100644 index 00000000000..421fd569a9f --- /dev/null +++ b/factory/templates/locale.conf.in @@ -0,0 +1 @@ +LANG="{{ SYSTEMD_DEFAULT_LOCALE }}" diff --git a/factory/templates/meson.build b/factory/templates/meson.build new file mode 100644 index 00000000000..821f176a747 --- /dev/null +++ b/factory/templates/meson.build @@ -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) diff --git a/man/locale.conf.xml b/man/locale.conf.xml index b24ad9cf2eb..fe263fcfd84 100644 --- a/man/locale.conf.xml +++ b/man/locale.conf.xml @@ -64,14 +64,14 @@ might be checked for locale configuration as well, however only as fallback. - /etc/locale.conf is usually created and updated + /etc/locale.conf can be updated using systemd-localed.service8. localectl1 may be used to alter the settings in this file during runtime from the command line. Use systemd-firstboot1 - to initialize them on mounted (but not booted) system images. + to customize them on mounted (but not booted) system images. diff --git a/meson.build b/meson.build index c0cbadecb12..dc6cbf8a58f 100644 --- a/meson.build +++ b/meson.build @@ -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', diff --git a/tmpfiles.d/etc.conf.in b/tmpfiles.d/etc.conf.in index ebdc699c262..2fdd498da58 100644 --- a/tmpfiles.d/etc.conf.in +++ b/tmpfiles.d/etc.conf.in @@ -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 - - - -