]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
meson: Add nspawn-locale meson option
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 3 Jun 2022 11:18:10 +0000 (13:18 +0200)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 9 Jun 2022 04:08:27 +0000 (13:08 +0900)
https://github.com/systemd/systemd/pull/23192 caused breakage in
Arch Linux's build tooling. Let's give users an opt-out aside from
reverting the patch. It's hardly any maintenance work on our side
and gives users an easy way to revert the locale change if needed.

Of course, by default we still pick C.UTF-8 if the option is not
specified.

meson.build
meson_options.txt
src/nspawn/nspawn.c

index 2daaf3f4000d5555ab4332b5a18a7059d0774009..9adb2160a4ed00ded77cebe05e10b1508fdcc8d5 100644 (file)
@@ -937,6 +937,9 @@ conf.set_quoted('NTP_SERVERS', ntp_servers)
 default_locale = get_option('default-locale')
 conf.set_quoted('SYSTEMD_DEFAULT_LOCALE', default_locale)
 
+nspawn_locale = get_option('nspawn-locale')
+conf.set_quoted('SYSTEMD_NSPAWN_LOCALE', nspawn_locale)
+
 localegen_path = get_option('localegen-path')
 if localegen_path != ''
         conf.set_quoted('LOCALEGEN_PATH', localegen_path)
index 6c816abd65d19543385c7cdb2a70e265d4fdb86f..3bb25c6f763f0e93bb17a8d7e7072e08e8b876df 100644 (file)
@@ -302,6 +302,8 @@ option('gshadow', type : 'boolean',
        description : 'support for shadow group')
 option('default-locale', type : 'string', value : 'C.UTF-8',
        description : 'default locale used when /etc/locale.conf does not exist')
+option('nspawn-locale', type : 'string', value : 'C.UTF-8',
+       description : 'default locale used by systemd-nspawn when executing commands in a container')
 option('localegen-path', type : 'string', value : '',
        description : 'absolute path to the locale-gen binary in case the system is using locale-gen')
 option('service-watchdog', type : 'string', value : '3min',
index 8e3c6522e45625f249ef1545fdd35d25fa68ba98..a5cf4c2c19e334b7624f502750e1b244499d61bc 100644 (file)
@@ -3488,10 +3488,7 @@ static int inner_child(
         }
 
         if (arg_start_mode != START_BOOT) {
-                /* If we're running a command in the container, let's default to the C.UTF-8 locale as it's
-                 * part of glibc these days and was backported to most distros a long time before it got
-                 * added to upstream glibc. */
-                envp[n_env] = strdup("LANG=C.UTF-8");
+                envp[n_env] = strdup("LANG=" SYSTEMD_NSPAWN_LOCALE);
                 if (!envp[n_env])
                         return log_oom();
                 n_env++;