]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Make default locale a compile time option
authorDave Reisner <dreisner@archlinux.org>
Fri, 28 Dec 2018 12:38:36 +0000 (07:38 -0500)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 29 Dec 2018 12:43:04 +0000 (21:43 +0900)
Default to a locale that's guaranteed to exist everywhere, but let
distros override this with something more exotic if they choose to.

Closes #11259.

meson.build
meson_options.txt
src/core/locale-setup.c

index 1964b1aa87b489a67de722d420af436aefb922b6..9ca3b72e4d50003bf3377ed7b52687d57db4e7ba 100644 (file)
@@ -828,6 +828,9 @@ ntp_servers = get_option('ntp-servers')
 conf.set_quoted('NTP_SERVERS', ntp_servers)
 substs.set('NTP_SERVERS', ntp_servers)
 
+default_locale = get_option('default-locale')
+conf.set_quoted('SYSTEMD_DEFAULT_LOCALE', default_locale)
+
 conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
 
 substs.set('SUSHELL', get_option('debug-shell'))
@@ -3096,7 +3099,8 @@ status = [
         'default DNS-over-TLS mode:         @0@'.format(default_dns_over_tls),
         'default cgroup hierarchy:          @0@'.format(default_hierarchy),
         'default net.naming-scheme setting: @0@'.format(default_net_naming_scheme),
-        'default KillUserProcesses setting: @0@'.format(kill_user_processes)]
+        'default KillUserProcesses setting: @0@'.format(kill_user_processes),
+        'default locale:                    @0@'.format(default_locale)]
 
 alt_dns_servers = '\n                                            '.join(dns_servers.split(' '))
 alt_ntp_servers = '\n                                            '.join(ntp_servers.split(' '))
index 1423b8998e5d3860fa245559ee0b8184764d57e4..7a75f380f9d6dc76d6c1ba7b8f5d96a7f135abe6 100644 (file)
@@ -195,6 +195,8 @@ option('default-kill-user-processes', type : 'boolean',
        description : 'the default value for KillUserProcesses= setting')
 option('gshadow', type : 'boolean',
        description : 'support for shadow group')
+option('default-locale', type : 'string', value : 'C',
+       description : 'default locale used when /etc/locale.conf does not exist')
 
 option('default-dnssec', type : 'combo',
        description : 'default DNSSEC mode',
index 584fb220a107ab6cb4a81e1dd7e20419798cbb78..aa4a89c17abc8927da4a6f48939601c5f95745e6 100644 (file)
@@ -74,9 +74,9 @@ int locale_setup(char ***environment) {
         }
 
         if (strv_isempty(add)) {
-                /* If no locale is configured then default to C.UTF-8. */
+                /* If no locale is configured then default to compile-time default. */
 
-                add = strv_new("LANG=C.UTF-8");
+                add = strv_new("LANG=" SYSTEMD_DEFAULT_LOCALE);
                 if (!add)
                         return -ENOMEM;
         }