; rest of target-pld.patch logic in systemd.spec
---- a/src/basic/hostname-util.h~ 2018-03-05 23:16:37.000000000 +0100
-+++ b/src/basic/hostname-util.h 2018-05-15 13:46:17.924678801 +0200
-@@ -42,5 +42,6 @@ int sethostname_idempotent(const char *s
+--- systemd-stable-248/src/shared/hostname-setup.h.orig 2021-03-30 22:59:02.000000000 +0200
++++ systemd-stable-248/src/shared/hostname-setup.h 2021-04-07 00:02:26.813489363 +0200
+@@ -18,6 +18,7 @@
int shorten_overlong(const char *s, char **ret);
+int read_etc_hostname_distro(const char *path, char **ret);
int read_etc_hostname_stream(FILE *f, char **ret);
int read_etc_hostname(const char *path, char **ret);
---- systemd-238/src/basic/hostname-util.c~ 2018-03-05 23:16:37.000000000 +0100
-+++ systemd-238/src/basic/hostname-util.c 2018-05-15 13:21:08.392017315 +0200
-@@ -8,6 +8,7 @@
+
+--- systemd-stable-248/src/shared/hostname-setup.c.orig 2021-03-30 22:59:02.000000000 +0200
++++ systemd-stable-248/src/shared/hostname-setup.c 2021-04-07 00:04:58.955649812 +0200
+@@ -7,6 +7,7 @@
#include <unistd.h>
#include "alloc-util.h"
+#include "env-file.h"
#include "fd-util.h"
#include "fileio.h"
- #include "hostname-util.h"
-@@ -290,13 +290,33 @@ int read_etc_hostname_stream(FILE *f, ch
+ #include "fs-util.h"
+@@ -130,13 +131,34 @@
}
}
+int read_etc_hostname_distro(const char *path, char **ret) {
+ int r;
+ char *p = NULL;
-+ r = parse_env_file(NULL, "/etc/sysconfig/network", NEWLINE, "HOSTNAME", &p, NULL);
++ r = parse_env_file(NULL, "/etc/sysconfig/network", "HOSTNAME", &p);
+ if (r < 0)
+ return r;
-+ if (r == 0) /* EOF without any hostname? the file is empty, let's treat that exactly like no file at all: ENOENT */
++ if (!p) /* EOF without any hostname? the file is empty, let's treat that exactly like no file at all: ENOENT */
+ return -ENOENT;
+ hostname_cleanup(p);
+ if (!hostname_is_valid(p, true))
+ *ret = p;
+ return 0;
+}
++
+
int read_etc_hostname(const char *path, char **ret) {
_cleanup_fclose_ FILE *f = NULL;
f = fopen(path, "re");
if (!f)
-diff -dur -x '*~' -x '*.orig' systemd-208.orig/src/core/locale-setup.c systemd-208/src/core/locale-setup.c
---- systemd-208.orig/src/core/locale-setup.c 2013-10-01 00:17:21.000000000 +0200
-+++ systemd-208/src/core/locale-setup.c 2014-01-09 15:15:41.000000000 +0100
+--- systemd-240/src/shared/locale-setup.c.orig 2019-01-13 09:27:36.718995151 +0100
++++ systemd-240/src/shared/locale-setup.c 2019-01-13 09:29:37.548993771 +0100
@@ -21,6 +21,7 @@
- int r;
+ locale_context_clear(c);
- r = proc_cmdline_get_key_many(PROC_CMDLINE_STRIP_RD_PREFIX,
-+ "LANG", &variables[VARIABLE_LANG],
- "locale.LANG", &variables[VARIABLE_LANG],
- "locale.LANGUAGE", &variables[VARIABLE_LANGUAGE],
- "locale.LC_CTYPE", &variables[VARIABLE_LC_CTYPE],
-@@ -59,6 +60,15 @@
- log_warning_errno(r, "Failed to read /etc/locale.conf: %m");
- }
+ r = proc_cmdline_get_key_many(PROC_CMDLINE_STRIP_RD_PREFIX,
++ "LANG", &c->locale[VARIABLE_LANG],
+ "locale.LANG", &c->locale[VARIABLE_LANG],
+ "locale.LANGUAGE", &c->locale[VARIABLE_LANGUAGE],
+ "locale.LC_CTYPE", &c->locale[VARIABLE_LC_CTYPE],
+@@ -59,6 +60,17 @@
+ if (r < 0 && errno != ENOENT)
+ return log_debug_errno(errno, "Failed to stat /etc/locale.conf: %m");
-+ if (r <= 0 &&
-+ (r = parse_env_file(NULL, "/etc/sysconfig/i18n", NEWLINE,
-+ "LANG", &variables[VARIABLE_LANG],
-+ NULL)) < 0) {
++ if (r < 0 && stat("/etc/sysconfig/i18n", &st) == 0) {
++ locale_context_clear(c);
++ if ((r = parse_env_file(NULL, "/etc/sysconfig/i18n",
++ "LANG", &c->locale[VARIABLE_LANG]
++ )) < 0) {
+
-+ if (r != -ENOENT)
-+ log_warning_errno(r, "Failed to read /etc/sysconfig/i18n: %m");
++ if (r != -ENOENT)
++ log_warning_errno(r, "Failed to read /etc/sysconfig/i18n: %m");
++ }
+ }
+
- for (i = 0; i < _VARIABLE_LC_MAX; i++) {
- char *s;
-
---- a/src/basic/time-util.c~ 2016-11-03 18:16:42.000000000 +0100
-+++ b/src/basic/time-util.c 2016-11-12 19:54:28.457197174 +0100
+ if (r >= 0) {
+ /* If mtime is not changed, then we do not need to re-read the file. */
+ t = timespec_load(&st.st_mtim);
+--- systemd-240/src/basic/time-util.c.orig 2019-01-13 09:27:36.718995151 +0100
++++ systemd-240/src/basic/time-util.c 2019-01-13 09:31:12.275659356 +0100
@@ -14,6 +14,7 @@
#include <unistd.h>
- if (!e)
- return -EINVAL;
+ if (!e) {
-+ r = parse_env_file(NULL, "/etc/sysconfig/timezone", NEWLINE,
-+ "TIMEZONE", &e,
-+ NULL);
++ r = parse_env_file(NULL, "/etc/sysconfig/timezone"
++ "TIMEZONE", &e
++ );
+ if (r < 0) {
+ if (r != -ENOENT)
+ log_warning_errno(r, "Failed to read /etc/sysconfig/timezone: %m");
+ return -EINVAL;
+ }
-+ }
++ }
if (!timezone_is_valid(e, LOG_DEBUG))
return -EINVAL;
-diff -dur -x '*~' -x '*.orig' systemd-208.orig/src/vconsole/vconsole-setup.c systemd-208/src/vconsole/vconsole-setup.c
---- systemd-208.orig/src/vconsole/vconsole-setup.c 2013-08-13 22:02:47.000000000 +0200
-+++ systemd-208/src/vconsole/vconsole-setup.c 2014-01-09 15:17:49.000000000 +0100
+--- systemd-240.orig/src/vconsole/vconsole-setup.c 2013-08-13 22:02:47.000000000 +0200
++++ systemd-240/src/vconsole/vconsole-setup.c 2014-01-09 15:17:49.000000000 +0100
@@ -284,6 +284,17 @@ int main(int argc, char **argv) {
if (r < 0 && r != -ENOENT)
- log_warning("Failed to read /etc/vconsole.conf: %s", strerror(-r));
+ log_warning_errno(r, "Failed to read /etc/vconsole.conf: %m");
-+ if (r <= 0) {
-+ int r1 = parse_env_file(NULL, "/etc/sysconfig/console", NEWLINE,
++ if (r < 0) {
++ int r1 = parse_env_file(NULL, "/etc/sysconfig/console"
+ "CONSOLEFONT", &vc_font,
+ "CONSOLEMAP", &vc_font_map,
+ "CONSOLESCREENFONTMAP", &vc_font_unimap,
-+ "KEYTABLE", &vc_keymap,
-+ NULL);
++ "KEYTABLE", &vc_keymap
++ );
+ if (r1 < 0 && r1 != -ENOENT)
-+ log_warning("Failed to read /etc/sysconfig/console: %s", strerror(-r1));
++ log_warning_errno(r1, "Failed to read /etc/sysconfig/console: %m");
+ }
+
/* Let the kernel command line override /etc/vconsole.conf */
- if (detect_container(NULL) <= 0) {
- r = parse_env_file(NULL, "/proc/cmdline", WHITESPACE,
+ r = proc_cmdline_get_key_many(
+ PROC_CMDLINE_STRIP_RD_PREFIX,