]>
Commit | Line | Data |
---|---|---|
440d1d13 BZ |
1 | diff --git a/Makefile.am b/Makefile.am |
2 | index 170465a..bce467d 100644 | |
3 | --- a/Makefile.am | |
4 | +++ b/Makefile.am | |
da7cff0c JR |
5 | @@ -4083,6 +4083,21 @@ if TARGET_FEDORA |
6 | $(LN_S) ../systemd-modules-load.service systemd-modules-load.service ) | |
440d1d13 BZ |
7 | endif |
8 | ||
440d1d13 BZ |
9 | + $(MKDIR_P) -m 0755 $(DESTDIR)$(systemunitdir)/final.target.wants |
10 | + ( cd $(DESTDIR)$(systemunitdir)/multi-user.target.wants && \ | |
11 | + rm -f rc-local.service && \ | |
4d29e184 BZ |
12 | + $(LN_S) $(systemunitdir)/rc-local.service rc-local.service ) |
13 | + ( cd $(DESTDIR)$(systemunitdir)/final.target.wants && \ | |
14 | + rm -f halt-local.service && \ | |
15 | + $(LN_S) $(systemunitdir)/halt-local.service halt-local.service ) | |
16 | + ( cd $(DESTDIR)$(systemunitdir) && \ | |
17 | + rm -f display-manager.service single.service && \ | |
18 | + $(LN_S) prefdm.service display-manager.service && \ | |
19 | + $(LN_S) rescue.service single.service ) | |
20 | + ( cd $(DESTDIR)$(systemunitdir)/graphical.target.wants && \ | |
21 | + rm -f display-manager.service && \ | |
22 | + $(LN_S) $(systemunitdir)/display-manager.service display-manager.service ) | |
4d29e184 | 23 | + |
da7cff0c | 24 | install-exec-hook: $(INSTALL_EXEC_HOOKS) |
440d1d13 | 25 | |
da7cff0c | 26 | uninstall-hook: $(UNINSTALL_DATA_HOOKS) $(UNINSTALL_EXEC_HOOKS) |
082609ad | 27 | diff --git a/src/core/hostname-setup.c b/src/core/hostname-setup.c |
440d1d13 | 28 | index 2c2f10c..754f0c7 100644 |
082609ad JR |
29 | --- a/src/core/hostname-setup.c |
30 | +++ b/src/core/hostname-setup.c | |
da7cff0c JR |
31 | @@ -64,13 +64,84 @@ static int read_and_strip_hostname(const char *path, char **hn) { |
32 | return 0; | |
33 | } | |
4d29e184 | 34 | |
da7cff0c JR |
35 | +static int read_distro_hostname(char **hn) { |
36 | + int r; | |
37 | + _cleanup_fclose_ FILE *f = NULL; | |
38 | + | |
39 | + assert(hn); | |
40 | + | |
41 | + f = fopen("/etc/sysconfig/network", "re"); | |
42 | + if (!f) | |
43 | + return -errno; | |
44 | + | |
45 | + for (;;) { | |
46 | + char line[LINE_MAX]; | |
47 | + char *s, *k; | |
48 | + | |
49 | + if (!fgets(line, sizeof(line), f)) { | |
50 | + if (feof(f)) | |
51 | + break; | |
52 | + | |
53 | + r = -errno; | |
54 | + goto finish; | |
55 | + } | |
56 | + | |
57 | + s = strstrip(line); | |
58 | + | |
59 | + if (!startswith_no_case(s, "HOSTNAME=")) | |
60 | + continue; | |
61 | + | |
62 | + k = strdup(s+9); | |
63 | + if (!k) { | |
64 | + r = -ENOMEM; | |
65 | + goto finish; | |
66 | + } | |
67 | + | |
68 | + hostname_cleanup(k); | |
69 | + | |
70 | + if (isempty(k)) { | |
71 | + free(k); | |
72 | + r = -ENOENT; | |
73 | + goto finish; | |
74 | + } | |
75 | + | |
76 | + *hn = k; | |
77 | + r = 0; | |
78 | + goto finish; | |
79 | + } | |
80 | + | |
81 | + r = -ENOENT; | |
82 | + | |
83 | +finish: | |
84 | + return r; | |
85 | +} | |
86 | + | |
87 | +static int read_hostname(char **hn) { | |
88 | + int r; | |
89 | + | |
90 | + assert(hn); | |
91 | + | |
92 | + /* First, try to load the generic hostname configuration file, | |
93 | + * that we support on all distributions */ | |
94 | + | |
95 | + r = read_and_strip_hostname("/etc/hostname", hn); | |
96 | + if (r < 0) { | |
97 | + if (r == -ENOENT) | |
98 | + return read_distro_hostname(hn); | |
99 | + | |
100 | + return r; | |
101 | + } | |
102 | + | |
103 | + return 0; | |
104 | +} | |
105 | + | |
106 | int hostname_setup(void) { | |
4d29e184 | 107 | int r; |
da7cff0c JR |
108 | _cleanup_free_ char *b = NULL; |
109 | const char *hn; | |
110 | bool enoent = false; | |
4d29e184 | 111 | |
da7cff0c JR |
112 | - r = read_and_strip_hostname("/etc/hostname", &b); |
113 | + r = read_hostname(&b); | |
114 | if (r < 0) { | |
115 | if (r == -ENOENT) | |
116 | enoent = true; | |
082609ad | 117 | diff --git a/src/core/locale-setup.c b/src/core/locale-setup.c |
440d1d13 | 118 | index 7f692e9..0a45854 100644 |
082609ad JR |
119 | --- a/src/core/locale-setup.c |
120 | +++ b/src/core/locale-setup.c | |
da7cff0c | 121 | @@ -74,6 +74,7 @@ int locale_setup(void) { |
4d29e184 | 122 | |
da7cff0c JR |
123 | if (detect_container(NULL) <= 0) { |
124 | r = parse_env_file("/proc/cmdline", WHITESPACE, | |
125 | + "LANG", &variables[VARIABLE_LANG], | |
126 | "locale.LANG", &variables[VARIABLE_LANG], | |
127 | "locale.LANGUAGE", &variables[VARIABLE_LANGUAGE], | |
128 | "locale.LC_CTYPE", &variables[VARIABLE_LC_CTYPE], | |
129 | @@ -121,6 +121,15 @@ int locale_setup(void) { | |
4d29e184 BZ |
130 | log_warning("Failed to read /etc/locale.conf: %s", strerror(-r)); |
131 | } | |
132 | ||
da7cff0c JR |
133 | + if (r <= 0 && |
134 | + (r = parse_env_file("/etc/sysconfig/i18n", NEWLINE, | |
135 | + "LANG", &variables[VARIABLE_LANG], | |
136 | + NULL)) < 0) { | |
137 | + | |
138 | + if (r != -ENOENT) | |
139 | + log_warning("Failed to read /etc/sysconfig/i18n: %s", strerror(-r)); | |
140 | + } | |
141 | + | |
142 | if (!variables[VARIABLE_LANG]) { | |
143 | variables[VARIABLE_LANG] = strdup("C"); | |
144 | if (!variables[VARIABLE_LANG]) { | |
a2211e27 JR |
145 | --- systemd-196/src/timedate/timedated.c~ 2012-10-16 23:35:40.589269718 +0200 |
146 | +++ systemd-196/src/timedate/timedated.c 2012-12-21 11:46:13.545086335 +0100 | |
da7cff0c | 147 | @@ -175,6 +175,13 @@ |
a2211e27 JR |
148 | } |
149 | } | |
150 | ||
a2211e27 JR |
151 | + r = parse_env_file("/etc/sysconfig/timezone", NEWLINE, |
152 | + "TIMEZONE", &tz.zone, | |
153 | + NULL); | |
154 | + if (r < 0) { | |
155 | + if (r != -ENOENT) | |
156 | + log_warning("Failed to read /etc/sysconfig/timezone: %s", strerror(-r)); | |
157 | + } | |
a2211e27 JR |
158 | #ifdef HAVE_DEBIAN |
159 | r = read_one_line_file("/etc/timezone", &tz.zone); | |
160 | if (r < 0) { | |
440d1d13 BZ |
161 | diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c |
162 | index 9196789..1d1a916 100644 | |
163 | --- a/src/vconsole/vconsole-setup.c | |
164 | +++ b/src/vconsole/vconsole-setup.c | |
da7cff0c JR |
165 | @@ -358,6 +358,14 @@ |
166 | } | |
167 | ||
168 | if (r <= 0) { | |
618c1d39 JR |
169 | + r = parse_env_file("/etc/sysconfig/console", NEWLINE, |
170 | + "CONSOLEFONT", &vc_font, | |
171 | + "CONSOLEMAP", &vc_font_map, | |
172 | + "CONSOLESCREENFONTMAP", &vc_font_unimap, | |
173 | + "KEYTABLE", &vc_keymap, | |
174 | + NULL); | |
175 | + if (r < 0 && r != -ENOENT) | |
176 | + log_warning("Failed to read /etc/sysconfig/console: %s", strerror(-r)); | |
4d29e184 BZ |
177 | } |
178 | ||
da7cff0c | 179 | r = EXIT_FAILURE; |