]> git.pld-linux.org Git - packages/systemd.git/blame - target-pld.patch
- partial update to 238; target-pld.patch hostname parsing needs testing; files secti...
[packages/systemd.git] / target-pld.patch
CommitLineData
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);
11--- systemd-238/src/basic/hostname-util.c~ 2018-03-05 23:16:37.000000000 +0100
12+++ systemd-238/src/basic/hostname-util.c 2018-05-15 13:21:08.392017315 +0200
13@@ -290,13 +290,33 @@ int read_etc_hostname_stream(FILE *f, ch
14 }
da7cff0c 15 }
4d29e184 16
7d414874 17+int read_etc_hostname_distro(const char *path, char **ret) {
da7cff0c 18+ int r;
7d414874
AM
19+ char *p;
20+ r = parse_env_file("/etc/sysconfig/network", NEWLINE, "HOSTNAME", &p, NULL);
21+ if (r < 0)
da7cff0c 22+ return r;
7d414874
AM
23+ if (r == 0) /* EOF without any hostname? the file is empty, let's treat that exactly like no file at all: ENOENT */
24+ return -ENOENT;
25+ hostname_cleanup(p);
26+ if (!hostname_is_valid(p, true))
27+ return -EBADMSG;
28+ *ret = p;
29+ return 0;
da7cff0c
JR
30+}
31+
7d414874
AM
32 int read_etc_hostname(const char *path, char **ret) {
33 _cleanup_fclose_ FILE *f = NULL;
34
35 assert(ret);
36
37- if (!path)
38+ if (!path) {
39+ int r;
40 path = "/etc/hostname";
41+ r = read_etc_hostname_distro(path, ret);
42+ if (r > 0)
43+ return r;
44+ }
4d29e184 45
7d414874
AM
46 f = fopen(path, "re");
47 if (!f)
808bb44c
JK
48diff -dur -x '*~' -x '*.orig' systemd-208.orig/src/core/locale-setup.c systemd-208/src/core/locale-setup.c
49--- systemd-208.orig/src/core/locale-setup.c 2013-10-01 00:17:21.000000000 +0200
50+++ systemd-208/src/core/locale-setup.c 2014-01-09 15:15:41.000000000 +0100
51@@ -76,6 +76,7 @@
4d29e184 52
da7cff0c
JR
53 if (detect_container(NULL) <= 0) {
54 r = parse_env_file("/proc/cmdline", WHITESPACE,
55+ "LANG", &variables[VARIABLE_LANG],
56 "locale.LANG", &variables[VARIABLE_LANG],
57 "locale.LANGUAGE", &variables[VARIABLE_LANGUAGE],
58 "locale.LC_CTYPE", &variables[VARIABLE_LC_CTYPE],
808bb44c 59@@ -120,6 +121,15 @@
4d29e184
BZ
60 log_warning("Failed to read /etc/locale.conf: %s", strerror(-r));
61 }
62
da7cff0c
JR
63+ if (r <= 0 &&
64+ (r = parse_env_file("/etc/sysconfig/i18n", NEWLINE,
65+ "LANG", &variables[VARIABLE_LANG],
66+ NULL)) < 0) {
67+
68+ if (r != -ENOENT)
69+ log_warning("Failed to read /etc/sysconfig/i18n: %s", strerror(-r));
70+ }
71+
3d025d25 72 add = NULL;
11fa1d33 73 for (i = 0; i < _VARIABLE_MAX; i++) {
808bb44c 74 char *s;
c75f826c
AM
75--- a/src/basic/time-util.c~ 2016-11-03 18:16:42.000000000 +0100
76+++ b/src/basic/time-util.c 2016-11-12 19:54:28.457197174 +0100
77@@ -1290,8 +1290,16 @@ int get_timezone(char **tz) {
78 e = path_startswith(t, "/usr/share/zoneinfo/");
79 if (!e)
80 e = path_startswith(t, "../usr/share/zoneinfo/");
81- if (!e)
82- return -EINVAL;
83+ if (!e) {
84+ r = parse_env_file("/etc/sysconfig/timezone", NEWLINE,
85+ "TIMEZONE", &e,
86+ NULL);
87+ if (r < 0) {
88+ if (r != -ENOENT)
89+ log_warning("Failed to read /etc/sysconfig/timezone: %s", strerror(-r));
90+ return -EINVAL;
91+ }
92+ }
a2211e27 93
c75f826c
AM
94 if (!timezone_is_valid(e))
95 return -EINVAL;
808bb44c
JK
96diff -dur -x '*~' -x '*.orig' systemd-208.orig/src/vconsole/vconsole-setup.c systemd-208/src/vconsole/vconsole-setup.c
97--- systemd-208.orig/src/vconsole/vconsole-setup.c 2013-08-13 22:02:47.000000000 +0200
98+++ systemd-208/src/vconsole/vconsole-setup.c 2014-01-09 15:17:49.000000000 +0100
abea5afb
AM
99@@ -284,6 +284,17 @@ int main(int argc, char **argv) {
100 if (r < 0 && r != -ENOENT)
101 log_warning("Failed to read /etc/vconsole.conf: %s", strerror(-r));
808bb44c 102
d31498aa 103+ if (r <= 0) {
abea5afb
AM
104+ int r1 = parse_env_file("/etc/sysconfig/console", NEWLINE,
105+ "CONSOLEFONT", &vc_font,
106+ "CONSOLEMAP", &vc_font_map,
107+ "CONSOLESCREENFONTMAP", &vc_font_unimap,
108+ "KEYTABLE", &vc_keymap,
109+ NULL);
808bb44c
JK
110+ if (r1 < 0 && r1 != -ENOENT)
111+ log_warning("Failed to read /etc/sysconfig/console: %s", strerror(-r1));
abea5afb 112+ }
808bb44c 113+
abea5afb
AM
114 /* Let the kernel command line override /etc/vconsole.conf */
115 if (detect_container(NULL) <= 0) {
116 r = parse_env_file("/proc/cmdline", WHITESPACE,
This page took 0.058862 seconds and 4 git commands to generate.