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