]> git.pld-linux.org Git - packages/systemd.git/blob - target-pld.patch
784c3409d7535b8f716bb75da4ba8bf578deba32
[packages/systemd.git] / target-pld.patch
1 ; rest of target-pld.patch logic in systemd.spec
2 diff -dur -x '*~' -x '*.orig' systemd-208.orig/src/core/hostname-setup.c systemd-208/src/core/hostname-setup.c
3 --- systemd-208.orig/src/core/hostname-setup.c  2013-08-13 22:02:46.000000000 +0200
4 +++ systemd-208/src/core/hostname-setup.c       2014-01-09 15:15:41.000000000 +0100
5 @@ -23,6 +23,7 @@
6  
7  #include "alloc-util.h"
8  #include "fileio.h"
9 +#include "fd-util.h"
10  #include "hostname-setup.h"
11  #include "hostname-util.h"
12  #include "log.h"
13 @@ -53,13 +53,84 @@
14          return 0;
15  }
16  
17 +static int read_distro_hostname(char **hn) {
18 +        int r;
19 +        _cleanup_fclose_ FILE *f = NULL;
20 +
21 +        assert(hn);
22 +
23 +        f = fopen("/etc/sysconfig/network", "re");
24 +        if (!f)
25 +                return -errno;
26 +
27 +        for (;;) {
28 +                char line[LINE_MAX];
29 +                char *s, *k;
30 +
31 +                if (!fgets(line, sizeof(line), f)) {
32 +                        if (feof(f))
33 +                                break;
34 +
35 +                        r = -errno;
36 +                        goto finish;
37 +                }
38 +
39 +                s = strstrip(line);
40 +
41 +                if (!startswith_no_case(s, "HOSTNAME="))
42 +                        continue;
43 +
44 +                k = strdup(s+9);
45 +                if (!k) {
46 +                        r = -ENOMEM;
47 +                        goto finish;
48 +                }
49 +
50 +                hostname_cleanup(k);
51 +
52 +                if (isempty(k)) {
53 +                        free(k);
54 +                        r = -ENOENT;
55 +                        goto finish;
56 +                }
57 +
58 +                *hn = k;
59 +                r = 0;
60 +                goto finish;
61 +        }
62 +
63 +        r = -ENOENT;
64 +
65 +finish:
66 +        return r;
67 +}
68 +
69 +static int read_hostname(char **hn) {
70 +        int r;
71 +
72 +        assert(hn);
73 +
74 +        /* First, try to load the generic hostname configuration file,
75 +         * that we support on all distributions */
76 +
77 +        r = read_hostname_config("/etc/hostname", hn);
78 +        if (r < 0) {
79 +                if (r == -ENOENT)
80 +                        return read_distro_hostname(hn);
81 +
82 +                return r;
83 +        }
84 +
85 +        return 0;
86 +}
87 +
88  int hostname_setup(void) {
89          _cleanup_free_ char *b = NULL;
90          bool enoent = false;
91          const char *hn;
92          int r;
93  
94 -        r = read_hostname_config("/etc/hostname", &b);
95 +        r = read_hostname(&b);
96          if (r < 0) {
97                  if (r == -ENOENT)
98                          enoent = true;
99 diff -dur -x '*~' -x '*.orig' systemd-208.orig/src/core/locale-setup.c systemd-208/src/core/locale-setup.c
100 --- systemd-208.orig/src/core/locale-setup.c    2013-10-01 00:17:21.000000000 +0200
101 +++ systemd-208/src/core/locale-setup.c 2014-01-09 15:15:41.000000000 +0100
102 @@ -76,6 +76,7 @@
103  
104          if (detect_container(NULL) <= 0) {
105                  r = parse_env_file("/proc/cmdline", WHITESPACE,
106 +                                   "LANG",                     &variables[VARIABLE_LANG],
107                                     "locale.LANG",              &variables[VARIABLE_LANG],
108                                     "locale.LANGUAGE",          &variables[VARIABLE_LANGUAGE],
109                                     "locale.LC_CTYPE",          &variables[VARIABLE_LC_CTYPE],
110 @@ -120,6 +121,15 @@
111                          log_warning("Failed to read /etc/locale.conf: %s", strerror(-r));
112          }
113  
114 +        if (r <= 0 &&
115 +            (r = parse_env_file("/etc/sysconfig/i18n", NEWLINE,
116 +                                "LANG", &variables[VARIABLE_LANG],
117 +                                NULL)) < 0) {
118 +
119 +                if (r != -ENOENT)
120 +                        log_warning("Failed to read /etc/sysconfig/i18n: %s", strerror(-r));
121 +        }
122 +
123          add = NULL;
124          for (i = 0; i < _VARIABLE_MAX; i++) {
125                  char *s;
126 --- a/src/basic/time-util.c~    2016-11-03 18:16:42.000000000 +0100
127 +++ b/src/basic/time-util.c     2016-11-12 19:54:28.457197174 +0100
128 @@ -1290,8 +1290,16 @@ int get_timezone(char **tz) {
129          e = path_startswith(t, "/usr/share/zoneinfo/");
130          if (!e)
131                  e = path_startswith(t, "../usr/share/zoneinfo/");
132 -        if (!e)
133 -                return -EINVAL;
134 +        if (!e) {
135 +                r = parse_env_file("/etc/sysconfig/timezone", NEWLINE,
136 +                        "TIMEZONE", &e,
137 +                        NULL);
138 +                if (r < 0) {
139 +                        if (r != -ENOENT)
140 +                                log_warning("Failed to read /etc/sysconfig/timezone: %s", strerror(-r));
141 +                        return -EINVAL;
142 +                }
143 +        }
144  
145          if (!timezone_is_valid(e))
146                  return -EINVAL;
147 diff -dur -x '*~' -x '*.orig' systemd-208.orig/src/vconsole/vconsole-setup.c systemd-208/src/vconsole/vconsole-setup.c
148 --- systemd-208.orig/src/vconsole/vconsole-setup.c      2013-08-13 22:02:47.000000000 +0200
149 +++ systemd-208/src/vconsole/vconsole-setup.c   2014-01-09 15:17:49.000000000 +0100
150 @@ -284,6 +284,17 @@ int main(int argc, char **argv) {
151          if (r < 0 && r != -ENOENT)
152                  log_warning("Failed to read /etc/vconsole.conf: %s", strerror(-r));
153  
154 +        if (r <= 0) {
155 +                int r1 = parse_env_file("/etc/sysconfig/console", NEWLINE,
156 +                                "CONSOLEFONT", &vc_font,
157 +                                "CONSOLEMAP", &vc_font_map,
158 +                                "CONSOLESCREENFONTMAP", &vc_font_unimap,
159 +                                "KEYTABLE", &vc_keymap,
160 +                                NULL);
161 +                if (r1 < 0 && r1 != -ENOENT)
162 +                        log_warning("Failed to read /etc/sysconfig/console: %s", strerror(-r1));
163 +        } 
164 +
165          /* Let the kernel command line override /etc/vconsole.conf */
166          if (detect_container(NULL) <= 0) {
167                  r = parse_env_file("/proc/cmdline", WHITESPACE,
This page took 0.07204 seconds and 2 git commands to generate.