]>
Commit | Line | Data |
---|---|---|
f06261ce | 1 | ; rest of target-pld.patch logic in systemd.spec |
7d414874 AM |
2 | --- a/src/basic/hostname-util.h~ 2018-03-05 23:16:37.000000000 +0100 |
3 | +++ b/src/basic/hostname-util.h 2018-05-15 13:46:17.924678801 +0200 | |
4 | @@ -42,5 +42,6 @@ int sethostname_idempotent(const char *s | |
c75f826c | 5 | |
7d414874 AM |
6 | int shorten_overlong(const char *s, char **ret); |
7 | ||
8 | +int read_etc_hostname_distro(const char *path, char **ret); | |
9 | int read_etc_hostname_stream(FILE *f, char **ret); | |
10 | int read_etc_hostname(const char *path, char **ret); | |
a8a1a634 JB |
11 | --- systemd-240/src/basic/hostname-util.c.orig 2018-12-21 19:53:33.000000000 +0100 |
12 | +++ systemd-240/src/basic/hostname-util.c 2019-01-13 11:11:40.715590524 +0100 | |
a919bc1d JP |
13 | @@ -8,6 +8,7 @@ |
14 | #include <unistd.h> | |
15 | ||
16 | #include "alloc-util.h" | |
17 | +#include "env-file.h" | |
18 | #include "fd-util.h" | |
19 | #include "fileio.h" | |
20 | #include "hostname-util.h" | |
7d414874 AM |
21 | @@ -290,13 +290,33 @@ int read_etc_hostname_stream(FILE *f, ch |
22 | } | |
da7cff0c | 23 | } |
4d29e184 | 24 | |
7d414874 | 25 | +int read_etc_hostname_distro(const char *path, char **ret) { |
da7cff0c | 26 | + int r; |
dc5fbf40 | 27 | + char *p = NULL; |
057a68c8 | 28 | + r = parse_env_file(NULL, "/etc/sysconfig/network", "HOSTNAME", &p); |
7d414874 | 29 | + if (r < 0) |
da7cff0c | 30 | + return r; |
489cb848 | 31 | + if (!p) /* EOF without any hostname? the file is empty, let's treat that exactly like no file at all: ENOENT */ |
7d414874 AM |
32 | + return -ENOENT; |
33 | + hostname_cleanup(p); | |
34 | + if (!hostname_is_valid(p, true)) | |
35 | + return -EBADMSG; | |
36 | + *ret = p; | |
37 | + return 0; | |
da7cff0c JR |
38 | +} |
39 | + | |
7d414874 AM |
40 | int read_etc_hostname(const char *path, char **ret) { |
41 | _cleanup_fclose_ FILE *f = NULL; | |
42 | ||
43 | assert(ret); | |
44 | ||
45 | - if (!path) | |
46 | + if (!path) { | |
47 | + int r; | |
48 | path = "/etc/hostname"; | |
49 | + r = read_etc_hostname_distro(path, ret); | |
d38d6806 | 50 | + if (r == 0) |
7d414874 AM |
51 | + return r; |
52 | + } | |
4d29e184 | 53 | |
7d414874 AM |
54 | f = fopen(path, "re"); |
55 | if (!f) | |
a8a1a634 JB |
56 | --- systemd-240/src/core/locale-setup.c.orig 2019-01-13 09:27:36.718995151 +0100 |
57 | +++ systemd-240/src/core/locale-setup.c 2019-01-13 09:29:37.548993771 +0100 | |
a919bc1d JP |
58 | @@ -21,6 +21,7 @@ |
59 | int r; | |
4d29e184 | 60 | |
a919bc1d JP |
61 | r = proc_cmdline_get_key_many(PROC_CMDLINE_STRIP_RD_PREFIX, |
62 | + "LANG", &variables[VARIABLE_LANG], | |
63 | "locale.LANG", &variables[VARIABLE_LANG], | |
64 | "locale.LANGUAGE", &variables[VARIABLE_LANGUAGE], | |
65 | "locale.LC_CTYPE", &variables[VARIABLE_LC_CTYPE], | |
66 | @@ -59,6 +60,15 @@ | |
67 | log_warning_errno(r, "Failed to read /etc/locale.conf: %m"); | |
4d29e184 BZ |
68 | } |
69 | ||
da7cff0c | 70 | + if (r <= 0 && |
057a68c8 JP |
71 | + (r = parse_env_file(NULL, "/etc/sysconfig/i18n", |
72 | + "LANG", &variables[VARIABLE_LANG] | |
73 | + )) < 0) { | |
da7cff0c JR |
74 | + |
75 | + if (r != -ENOENT) | |
a919bc1d | 76 | + log_warning_errno(r, "Failed to read /etc/sysconfig/i18n: %m"); |
da7cff0c JR |
77 | + } |
78 | + | |
a919bc1d | 79 | for (i = 0; i < _VARIABLE_LC_MAX; i++) { |
808bb44c | 80 | char *s; |
a919bc1d | 81 | |
a8a1a634 JB |
82 | --- systemd-240/src/basic/time-util.c.orig 2019-01-13 09:27:36.718995151 +0100 |
83 | +++ systemd-240/src/basic/time-util.c 2019-01-13 09:31:12.275659356 +0100 | |
a919bc1d JP |
84 | @@ -14,6 +14,7 @@ |
85 | #include <unistd.h> | |
86 | ||
87 | #include "alloc-util.h" | |
88 | +#include "env-file.h" | |
89 | #include "fd-util.h" | |
90 | #include "fileio.h" | |
91 | #include "fs-util.h" | |
92 | @@ -1385,8 +1385,16 @@ | |
93 | return r; /* returns EINVAL if not a symlink */ | |
94 | ||
95 | e = PATH_STARTSWITH_SET(t, "/usr/share/zoneinfo/", "../usr/share/zoneinfo/"); | |
c75f826c AM |
96 | - if (!e) |
97 | - return -EINVAL; | |
98 | + if (!e) { | |
057a68c8 JP |
99 | + r = parse_env_file(NULL, "/etc/sysconfig/timezone" |
100 | + "TIMEZONE", &e | |
101 | + ); | |
c75f826c AM |
102 | + if (r < 0) { |
103 | + if (r != -ENOENT) | |
a919bc1d | 104 | + log_warning_errno(r, "Failed to read /etc/sysconfig/timezone: %m"); |
c75f826c AM |
105 | + return -EINVAL; |
106 | + } | |
a8a1a634 | 107 | + } |
a2211e27 | 108 | |
a919bc1d | 109 | if (!timezone_is_valid(e, LOG_DEBUG)) |
c75f826c | 110 | return -EINVAL; |
a8a1a634 JB |
111 | --- systemd-240.orig/src/vconsole/vconsole-setup.c 2013-08-13 22:02:47.000000000 +0200 |
112 | +++ systemd-240/src/vconsole/vconsole-setup.c 2014-01-09 15:17:49.000000000 +0100 | |
abea5afb AM |
113 | @@ -284,6 +284,17 @@ int main(int argc, char **argv) { |
114 | if (r < 0 && r != -ENOENT) | |
a8a1a634 | 115 | log_warning_errno(r, "Failed to read /etc/vconsole.conf: %m"); |
808bb44c | 116 | |
057a68c8 JP |
117 | + if (r < 0) { |
118 | + int r1 = parse_env_file(NULL, "/etc/sysconfig/console" | |
abea5afb AM |
119 | + "CONSOLEFONT", &vc_font, |
120 | + "CONSOLEMAP", &vc_font_map, | |
121 | + "CONSOLESCREENFONTMAP", &vc_font_unimap, | |
057a68c8 JP |
122 | + "KEYTABLE", &vc_keymap |
123 | + ); | |
808bb44c | 124 | + if (r1 < 0 && r1 != -ENOENT) |
a8a1a634 | 125 | + log_warning_errno(r1, "Failed to read /etc/sysconfig/console: %m"); |
abea5afb | 126 | + } |
808bb44c | 127 | + |
abea5afb AM |
128 | /* Let the kernel command line override /etc/vconsole.conf */ |
129 | if (detect_container(NULL) <= 0) { | |
9538a6a4 | 130 | r = parse_env_file(NULL, "/proc/cmdline", WHITESPACE, |