]> git.pld-linux.org Git - packages/systemd.git/blob - target-pld.patch
- partial update to 238; target-pld.patch hostname parsing needs testing; files secti...
[packages/systemd.git] / target-pld.patch
1 ; rest of target-pld.patch logic in systemd.spec
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
5  
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          }
15  }
16  
17 +int read_etc_hostname_distro(const char *path, char **ret) {
18 +        int r;
19 +        char *p;
20 +        r = parse_env_file("/etc/sysconfig/network", NEWLINE, "HOSTNAME", &p, NULL);
21 +        if (r < 0)
22 +                return r;
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;
30 +}
31 +
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 +        }
45  
46          f = fopen(path, "re");
47          if (!f)
48 diff -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 @@
52  
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],
59 @@ -120,6 +121,15 @@
60                          log_warning("Failed to read /etc/locale.conf: %s", strerror(-r));
61          }
62  
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 +
72          add = NULL;
73          for (i = 0; i < _VARIABLE_MAX; i++) {
74                  char *s;
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 +        }
93  
94          if (!timezone_is_valid(e))
95                  return -EINVAL;
96 diff -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
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));
102  
103 +        if (r <= 0) {
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);
110 +                if (r1 < 0 && r1 != -ENOENT)
111 +                        log_warning("Failed to read /etc/sysconfig/console: %s", strerror(-r1));
112 +        } 
113 +
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.039926 seconds and 3 git commands to generate.