SHA256
1
0
forked from pool/systemd
systemd/handle-etc-HOSTNAME.patch
Stephan Kulow bbba62be60 Accepting request 225408 from Base:System
- Add or port upstream bugfix patches: 
  0001-Fix-systemd-stdio-bridge-symlink.patch
  0002-execute-free-directory-path-if-we-fail-to-remove-it-.patch
  0003-Do-not-print-invalid-UTF-8-in-error-messages.patch
  0004-man-document-missing-options-of-systemd-run.patch
  0005-systemd-run-add-some-extra-safety-checks.patch
  0006-journal-assume-that-next-entry-is-after-previous-ent.patch
  0007-journal-forget-file-after-encountering-an-error.patch
  0008-core-correctly-unregister-PIDs-from-PID-hashtables.patch
  0009-logind-fix-reference-to-systemd-user-sessions.servic.patch
  0010-man-update-link-to-LSB.patch
  0011-man-systemd-bootchart-fix-spacing-in-command.patch
  0012-man-add-missing-comma.patch
  0013-units-Do-not-unescape-instance-name-in-systemd-backl.patch

- Add linker scripts as place holder of the old systemd shared
  libraries now all included in libsystemd.so  (bnc#867128)

- Make patch 1006-udev-always-rename-network.patch work again
  and add it again. 

- address missing owner functionality in systemd-tmpfiles (fate#314974)
  1022-systemd-tmpfiles-ownerkeep.patch

- Generate the bash completion files on the fly for the case of
  not having the package bash-completion around 
- Add or port upstream bugfix patches:
  0001-nspawn-fix-detection-of-missing-proc-self-loginuid.patch
  0002-cdrom_id-use-the-old-MMC-fallback.patch
  0003-journalctl-refuse-extra-arguments-with-verify-and-si.patch

OBS-URL: https://build.opensuse.org/request/show/225408
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=177
2014-03-11 08:24:11 +00:00

78 lines
2.5 KiB
Diff

From: Frederic Crozat <fcrozat@suse.com>
Date: Fri, 15 Feb 2013 16:04:39 +0000
Subject: handle /etc/HOSTNAME
(bnc#803653)
---
src/core/hostname-setup.c | 22 +++++++++++++++++-----
src/hostname/hostnamed.c | 12 +++++++++++-
2 files changed, 28 insertions(+), 6 deletions(-)
--- systemd-206/src/core/hostname-setup.c
+++ systemd-206/src/core/hostname-setup.c
@@ -61,12 +61,24 @@ int hostname_setup(void) {
r = read_and_strip_hostname("/etc/hostname", &b);
if (r < 0) {
- if (r == -ENOENT)
- enoent = true;
- else
- log_warning("Failed to read configured hostname: %s", strerror(-r));
+ if (r == -ENOENT) {
+ /* use SUSE fallback */
+ r = read_and_strip_hostname("/etc/HOSTNAME", &b);
+ if (r < 0) {
+ if (r == -ENOENT)
+ enoent = true;
+ else
+ log_warning("Failed to read configured hostname: %s", strerror(-r));
+ hn = NULL;
+ }
+ else
+ hn = b;
- hn = NULL;
+ }
+ else {
+ log_warning("Failed to read configured hostname: %s", strerror(-r));
+ hn = NULL;
+ }
} else
hn = b;
--- systemd-209/src/hostname/hostnamed.c
+++ systemd-209/src/hostname/hostnamed.c 2014-02-28 11:36:30.594735241 +0000
@@ -89,6 +89,10 @@ static int context_read_data(Context *c)
if (r < 0 && r != -ENOENT)
return r;
+ r = read_one_line_file("/etc/HOSTNAME", &c->data[PROP_STATIC_HOSTNAME]);
+ if (r < 0 && r != -ENOENT)
+ return r;
+
return 0;
}
@@ -246,6 +250,7 @@ static int context_write_data_hostname(C
}
static int context_write_data_static_hostname(Context *c) {
+ int r;
assert(c);
@@ -256,7 +261,12 @@ static int context_write_data_static_hos
return 0;
}
- return write_string_file_atomic_label("/etc/hostname", c->data[PROP_STATIC_HOSTNAME]);
+
+ r = write_string_file_atomic_label("/etc/hostname", c->data[PROP_STATIC_HOSTNAME]);
+ if (!r) {
+ r = symlink_atomic("/etc/hostname", "/etc/HOSTNAME");
+ }
+ return r;
}
static int context_write_data_other(Context *c) {