]> git.pld-linux.org Git - packages/systemd.git/blobdiff - target-pld.patch
- fix building with gcc 9.x
[packages/systemd.git] / target-pld.patch
index 616d35ce5975936809aa5785059e471d83db096b..68758c116a0f20d43cce4dcd8b7fd4b3be2d6b27 100644 (file)
-diff --git a/Makefile.am b/Makefile.am
-index 170465a..bce467d 100644
---- a/Makefile.am
-+++ b/Makefile.am
-@@ -196,6 +196,8 @@
- SYSINIT_TARGET_WANTS =
- SOCKETS_TARGET_WANTS =
- TIMERS_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 =
-@@ -214,6 +216,8 @@
-       what="$(SOCKETS_TARGET_WANTS)" && wants=sockets.target && $(add-wants)
-       what="$(TIMERS_TARGET_WANTS)" && wants=timers.target && $(add-wants)
-       what="$(SLICES_TARGET_WANTS)" && wants=slices.target && $(add-wants)
-+      what="$(FINAL_TARGET_WANTS)" && wants=final.target && $(add-wants)
-+      what="$(GRAPHICAL_TARGET_WANTS)" && wants=graphical.target && $(add-wants)
+ int shorten_overlong(const char *s, char **ret);
  
- define add-wants
-       [ -z "$$what" ] || ( \
-@@ -3388,9 +3392,16 @@
-       $(systemdstatedir)
++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-240/src/basic/hostname-util.c.orig 2018-12-21 19:53:33.000000000 +0100
++++ systemd-240/src/basic/hostname-util.c      2019-01-13 11:11:40.715590524 +0100
+@@ -8,6 +8,7 @@
+ #include <unistd.h>
  
- 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
-@@ -3790,6 +3801,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 --git a/src/core/hostname-setup.c b/src/core/hostname-setup.c
-index 2c2f10c..754f0c7 100644
---- a/src/core/hostname-setup.c
-+++ b/src/core/hostname-setup.c
-@@ -64,13 +64,84 @@ static int read_and_strip_hostname(const char *path, char **hn) {
-         return 0;
+ #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
+         }
  }
  
-+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 = NULL;
++        r = parse_env_file(NULL, "/etc/sysconfig/network", "HOSTNAME", &p);
++        if (r < 0)
 +                return r;
-+        }
-+
-+        return 0;
++        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))
++                 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;
  
--        r = read_and_strip_hostname("/etc/hostname", &b);
-+        r = read_hostname(&b);
-         if (r < 0) {
-                 if (r == -ENOENT)
-                         enoent = true;
-diff --git a/src/core/locale-setup.c b/src/core/locale-setup.c
-index 7f692e9..0a45854 100644
---- a/src/core/locale-setup.c
-+++ b/src/core/locale-setup.c
-@@ -74,6 +74,7 @@ int locale_setup(void) {
+         assert(ret);
  
-         if (detect_container(NULL) <= 0) {
-                 r = parse_env_file("/proc/cmdline", WHITESPACE,
-+                                   "LANG",                     &variables[VARIABLE_LANG],
-                                    "locale.LANG",              &variables[VARIABLE_LANG],
-                                    "locale.LANGUAGE",          &variables[VARIABLE_LANGUAGE],
-                                    "locale.LC_CTYPE",          &variables[VARIABLE_LC_CTYPE],
-@@ -121,6 +121,15 @@ int locale_setup(void) {
-                         log_warning("Failed to read /etc/locale.conf: %s", strerror(-r));
+-        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)
+--- systemd-240/src/core/locale-setup.c.orig   2019-01-13 09:27:36.718995151 +0100
++++ systemd-240/src/core/locale-setup.c        2019-01-13 09:29:37.548993771 +0100
+@@ -21,6 +21,7 @@
+         int r;
+         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");
          }
  
 +        if (r <= 0 &&
-+            (r = parse_env_file("/etc/sysconfig/i18n", NEWLINE,
-+                                "LANG", &variables[VARIABLE_LANG],
-+                                NULL)) < 0) {
++            (r = parse_env_file(NULL, "/etc/sysconfig/i18n",
++                                "LANG", &variables[VARIABLE_LANG]
++                                )) < 0) {
 +
 +                if (r != -ENOENT)
-+                        log_warning("Failed to read /etc/sysconfig/i18n: %s", strerror(-r));
++                        log_warning_errno(r, "Failed to read /etc/sysconfig/i18n: %m");
 +        }
 +
-         for (i = 0; i < _VARIABLE_MAX; i++) {
-                 if (variables[i]) {
-                         if (setenv(variable_names[i], variables[i], 1) < 0) {
---- systemd-196/src/timedate/timedated.c~      2012-10-16 23:35:40.589269718 +0200
-+++ systemd-196/src/timedate/timedated.c       2012-12-21 11:46:13.545086335 +0100
-@@ -175,6 +175,13 @@
-                 }
-         }
+         for (i = 0; i < _VARIABLE_LC_MAX; i++) {
+                 char *s;
  
-+      r = parse_env_file("/etc/sysconfig/timezone", NEWLINE,
-+                         "TIMEZONE", &tz.zone,
-+                         NULL);
-+      if (r < 0) {
-+              if (r != -ENOENT)
-+                      log_warning("Failed to read /etc/sysconfig/timezone: %s", strerror(-r));
+--- 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>
+ #include "alloc-util.h"
++#include "env-file.h"
+ #include "fd-util.h"
+ #include "fileio.h"
+ #include "fs-util.h"
+@@ -1385,8 +1385,16 @@
+                 return r; /* returns EINVAL if not a symlink */
+         e = PATH_STARTSWITH_SET(t, "/usr/share/zoneinfo/", "../usr/share/zoneinfo/");
+-        if (!e)
+-                return -EINVAL;
++        if (!e) {
++                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;
++                }
 +      }
- have_timezone:
-         if (isempty(tz.zone)) {
-                 free(tz.zone);
-diff --git a/src/vconsole/vconsole-setup.c b/src/vconsole/vconsole-setup.c
-index 9196789..1d1a916 100644
---- a/src/vconsole/vconsole-setup.c
-+++ b/src/vconsole/vconsole-setup.c
-@@ -358,6 +358,17 @@
-                 if (r < 0 && r != -ENOENT)
-                         log_warning("Failed to read /etc/vconsole.conf: %s", strerror(-r));
-         }
-+
-+        if (r <= 0) {
-+                r = parse_env_file("/etc/sysconfig/console", NEWLINE,
-+                                   "CONSOLEFONT", &vc_font,
-+                                   "CONSOLEMAP", &vc_font_map,
-+                                   "CONSOLESCREENFONTMAP", &vc_font_unimap,
-+                                   "KEYTABLE", &vc_keymap,
-+                                   NULL);
-+                if (r < 0 && r != -ENOENT)
-+                        log_warning("Failed to read /etc/sysconfig/console: %s", strerror(-r));
-+        }
  
-         if (utf8)
-                 enable_utf8(fd);
+         if (!timezone_is_valid(e, LOG_DEBUG))
+                 return -EINVAL;
+--- 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_errno(r, "Failed to read /etc/vconsole.conf: %m");
++        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
++                                );
++                if (r1 < 0 && r1 != -ENOENT)
++                        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,
This page took 0.040302 seconds and 4 git commands to generate.