2013-04-13 13:09:53 +02:00
|
|
|
From: Frederic Crozat <fcrozat@suse.com>
|
|
|
|
Date: Tue, 4 Dec 2012 16:51:32 +0000
|
|
|
|
Subject: handle root_uses_lang value in /etc/sysconfig/language
|
|
|
|
|
|
|
|
handle ROOT_USES_LANG=ctype (bnc#792182).
|
|
|
|
---
|
2015-02-13 10:43:21 +01:00
|
|
|
src/core/locale-setup.c | 26 ++++++++++++++++++++++++++
|
|
|
|
1 file changed, 26 insertions(+)
|
2013-04-13 13:09:53 +02:00
|
|
|
|
2015-06-23 14:56:50 +02:00
|
|
|
Index: systemd-221/src/core/locale-setup.c
|
2013-10-02 13:01:24 +02:00
|
|
|
===================================================================
|
2015-06-23 14:56:50 +02:00
|
|
|
--- systemd-221.orig/src/core/locale-setup.c
|
|
|
|
+++ systemd-221/src/core/locale-setup.c
|
2015-11-12 13:24:39 +01:00
|
|
|
@@ -34,6 +34,10 @@ int locale_setup(char ***environment) {
|
2013-10-02 13:01:24 +02:00
|
|
|
char **add;
|
2015-02-13 10:43:21 +01:00
|
|
|
char *variables[_VARIABLE_LC_MAX] = {};
|
2013-04-13 13:09:53 +02:00
|
|
|
int r = 0, i;
|
|
|
|
+#ifdef HAVE_SYSV_COMPAT
|
2015-11-12 13:24:39 +01:00
|
|
|
+ char _cleanup_free_ *rc_lang = NULL, *rc_lc_ctype = NULL;
|
|
|
|
+ char _cleanup_free_ *root_uses_lang = NULL;
|
2013-04-13 13:09:53 +02:00
|
|
|
+#endif
|
|
|
|
|
2013-04-19 22:31:17 +02:00
|
|
|
if (detect_container(NULL) <= 0) {
|
|
|
|
r = parse_env_file("/proc/cmdline", WHITESPACE,
|
2015-11-12 13:24:39 +01:00
|
|
|
@@ -80,6 +85,41 @@ int locale_setup(char ***environment) {
|
2013-07-23 11:21:21 +02:00
|
|
|
if (r < 0 && r != -ENOENT)
|
2015-02-13 10:43:21 +01:00
|
|
|
log_warning_errno(r, "Failed to read /etc/locale.conf: %m");
|
2013-04-13 13:09:53 +02:00
|
|
|
}
|
|
|
|
+#ifdef HAVE_SYSV_COMPAT
|
2015-11-12 13:24:39 +01:00
|
|
|
+ r = parse_env_file("/etc/sysconfig/language", NEWLINE,
|
|
|
|
+ "RC_LANG", &rc_lang,
|
|
|
|
+ "RC_LC_CTYPE", &rc_lc_ctype,
|
|
|
|
+ "ROOT_USES_LANG", &root_uses_lang,
|
|
|
|
+ NULL);
|
2013-04-13 13:09:53 +02:00
|
|
|
+
|
2015-11-12 13:24:39 +01:00
|
|
|
+ if (r < 0 && r != -ENOENT)
|
|
|
|
+ log_warning("Failed to read /etc/sysconfig/language: %s", strerror(-r));
|
2013-04-13 13:09:53 +02:00
|
|
|
+
|
2015-11-12 13:24:39 +01:00
|
|
|
+ /*
|
|
|
|
+ * Use the values of the interactive locale configuration in /etc/sysconfig/language
|
|
|
|
+ * as fallback if /etc/locale.conf does not exist and no locale was specified on the
|
|
|
|
+ * kernel's command line. The special case ROOT_USES_LANG=ctype allows to set LC_CTYPE
|
|
|
|
+ * even if LANG for root is set to e.g. POSIX. But do this only if no LC_CTYPE has been
|
|
|
|
+ * set in /etc/locale.conf and on the kernel's command line.
|
|
|
|
+ */
|
|
|
|
+ if (root_uses_lang) {
|
|
|
|
+ if (strcaseeq(root_uses_lang, "yes") && !variables[VARIABLE_LANG]) {
|
|
|
|
+ variables[VARIABLE_LANG] = rc_lang;
|
|
|
|
+ rc_lang = NULL;
|
|
|
|
+ }
|
|
|
|
+ if (strcaseeq(root_uses_lang, "ctype") && !variables[VARIABLE_LC_CTYPE]) {
|
|
|
|
+ if (variables[VARIABLE_LANG])
|
|
|
|
+ variables[VARIABLE_LC_CTYPE] = strdup(variables[VARIABLE_LANG]);
|
|
|
|
+ else if (rc_lc_ctype && *rc_lc_ctype) {
|
|
|
|
+ variables[VARIABLE_LC_CTYPE] = rc_lc_ctype;
|
|
|
|
+ rc_lc_ctype = NULL;
|
|
|
|
+ } else if (rc_lang && *rc_lang) {
|
|
|
|
+ variables[VARIABLE_LC_CTYPE] = rc_lang;
|
|
|
|
+ rc_lang = NULL;
|
|
|
|
+ }
|
|
|
|
+ }
|
2013-04-13 13:09:53 +02:00
|
|
|
+ }
|
|
|
|
+#endif
|
2013-07-23 11:21:21 +02:00
|
|
|
|
2013-10-02 13:01:24 +02:00
|
|
|
add = NULL;
|
2015-02-13 10:43:21 +01:00
|
|
|
for (i = 0; i < _VARIABLE_LC_MAX; i++) {
|