-diff -dur -x '*~' -x '*.orig' systemd-208.orig/Makefile.am systemd-208/Makefile.am
---- systemd-208.orig/Makefile.am 2013-10-02 04:57:09.000000000 +0200
-+++ systemd-208/Makefile.am 2014-01-09 15:15:41.000000000 +0100
-@@ -211,6 +211,8 @@
- TIMERS_TARGET_WANTS =
- USER_SOCKETS_TARGET_WANTS =
- USER_BUSNAMES_TARGET_WANTS =
-+FINAL_TARGET_WANTS =
-+GRAPHICAL_TARGET_WANTS =
+; 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
- SYSTEM_UNIT_ALIASES =
- USER_UNIT_ALIASES =
-@@ -230,6 +232,8 @@
- what="$(SLICES_TARGET_WANTS)" && wants=slices.target && $(add-wants)
- what="$(USER_SOCKETS_TARGET_WANTS)" && wants=sockets.target && dir=$(userunitdir) && $(add-wants)
- what="$(USER_BUSNAMES_TARGET_WANTS)" && wants=busnames.target && dir=$(userunitdir) && $(add-wants)
-+ what="$(FINAL_TARGET_WANTS)" && wants=final.target && dir=$(systemunitdir) && $(add-wants)
-+ what="$(GRAPHICAL_TARGET_WANTS)" && wants=graphical.target && dir=$(systemunitdir) && $(add-wants)
+ int shorten_overlong(const char *s, char **ret);
- define add-wants
- [ -z "$$what" ] || ( \
-@@ -4001,9 +4005,16 @@
- $(systemdstatedir)
-
- MULTI_USER_TARGET_WANTS += \
-+ rc-local.service \
- systemd-logind.service \
- systemd-user-sessions.service
-
-+FINAL_TARGET_WANTS += \
-+ halt-local.service
-+
-+GRAPHICAL_TARGET_WANTS += \
-+ display-manager.service
-+
- SYSTEM_UNIT_ALIASES += \
- systemd-logind.service dbus-org.freedesktop.login1.service
-
-@@ -4493,6 +4504,10 @@
- uninstall-hook: $(UNINSTALL_DATA_HOOKS) $(UNINSTALL_EXEC_HOOKS)
-
- install-data-hook: $(INSTALL_DATA_HOOKS)
-+ ( cd $(DESTDIR)$(systemunitdir) && \
-+ rm -f display-manager.service single.service && \
-+ $(LN_S) prefdm.service display-manager.service && \
-+ $(LN_S) rescue.service single.service )
-
- distclean-local: $(DISTCLEAN_LOCAL_HOOKS)
-
-diff -dur -x '*~' -x '*.orig' systemd-208.orig/src/core/hostname-setup.c systemd-208/src/core/hostname-setup.c
---- systemd-208.orig/src/core/hostname-setup.c 2013-08-13 22:02:46.000000000 +0200
-+++ systemd-208/src/core/hostname-setup.c 2014-01-09 15:15:41.000000000 +0100
-@@ -53,13 +53,84 @@
- return 0;
++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
+@@ -290,13 +290,33 @@ int read_etc_hostname_stream(FILE *f, ch
+ }
}
-+static int read_distro_hostname(char **hn) {
++int read_etc_hostname_distro(const char *path, char **ret) {
+ int r;
-+ _cleanup_fclose_ FILE *f = NULL;
-+
-+ assert(hn);
-+
-+ f = fopen("/etc/sysconfig/network", "re");
-+ if (!f)
-+ return -errno;
-+
-+ for (;;) {
-+ char line[LINE_MAX];
-+ char *s, *k;
-+
-+ if (!fgets(line, sizeof(line), f)) {
-+ if (feof(f))
-+ break;
-+
-+ r = -errno;
-+ goto finish;
-+ }
-+
-+ s = strstrip(line);
-+
-+ if (!startswith_no_case(s, "HOSTNAME="))
-+ continue;
-+
-+ k = strdup(s+9);
-+ if (!k) {
-+ r = -ENOMEM;
-+ goto finish;
-+ }
-+
-+ hostname_cleanup(k, false);
-+
-+ if (isempty(k)) {
-+ free(k);
-+ r = -ENOENT;
-+ goto finish;
-+ }
-+
-+ *hn = k;
-+ r = 0;
-+ goto finish;
-+ }
-+
-+ r = -ENOENT;
-+
-+finish:
-+ return r;
-+}
-+
-+static int read_hostname(char **hn) {
-+ int r;
-+
-+ assert(hn);
-+
-+ /* First, try to load the generic hostname configuration file,
-+ * that we support on all distributions */
-+
-+ r = read_and_strip_hostname("/etc/hostname", hn);
-+ if (r < 0) {
-+ if (r == -ENOENT)
-+ return read_distro_hostname(hn);
-+
++ char *p;
++ r = parse_env_file("/etc/sysconfig/network", NEWLINE, "HOSTNAME", &p, NULL);
++ if (r < 0)
+ return r;
-+ }
-+
-+ return 0;
++ if (r == 0) /* 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))
++ return -EBADMSG;
++ *ret = p;
++ return 0;
+}
+
- int hostname_setup(void) {
- int r;
- _cleanup_free_ char *b = NULL;
- const char *hn;
- bool enoent = false;
+ int read_etc_hostname(const char *path, char **ret) {
+ _cleanup_fclose_ FILE *f = NULL;
+
+ assert(ret);
-- r = read_and_strip_hostname("/etc/hostname", &b);
-+ r = read_hostname(&b);
- if (r < 0) {
- if (r == -ENOENT)
- enoent = true;
+- if (!path)
++ if (!path) {
++ int r;
+ path = "/etc/hostname";
++ r = read_etc_hostname_distro(path, ret);
++ if (r > 0)
++ return r;
++ }
+
+ 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
add = NULL;
for (i = 0; i < _VARIABLE_MAX; i++) {
char *s;
-diff -dur -x '*~' -x '*.orig' systemd-208.orig/src/timedate/timedated.c systemd-208/src/timedate/timedated.c
---- systemd-208.orig/src/timedate/timedated.c 2013-08-13 22:02:47.000000000 +0200
-+++ systemd-208/src/timedate/timedated.c 2014-01-09 15:15:41.000000000 +0100
-@@ -183,6 +183,14 @@
- }
- }
+--- 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
+@@ -1290,8 +1290,16 @@ int get_timezone(char **tz) {
+ e = path_startswith(t, "/usr/share/zoneinfo/");
+ if (!e)
+ e = path_startswith(t, "../usr/share/zoneinfo/");
+- if (!e)
+- return -EINVAL;
++ if (!e) {
++ r = parse_env_file("/etc/sysconfig/timezone", NEWLINE,
++ "TIMEZONE", &e,
++ NULL);
++ if (r < 0) {
++ if (r != -ENOENT)
++ log_warning("Failed to read /etc/sysconfig/timezone: %s", strerror(-r));
++ return -EINVAL;
++ }
++ }
-+ r = parse_env_file("/etc/sysconfig/timezone", NEWLINE,
-+ "TIMEZONE", &c->zone,
-+ NULL);
-+ if (r < 0) {
-+ if (r != -ENOENT)
-+ log_warning("Failed to read /etc/sysconfig/timezone: %s", strerror(-r));
-+ }
-+
- have_timezone:
- if (isempty(c->zone)) {
- free(c->zone);
+ if (!timezone_is_valid(e))
+ 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