systemd/handle-etc-HOSTNAME.patch

80 lines
2.6 KiB
Diff
Raw Normal View History

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 | 20 +++++++++++++++-----
src/hostname/hostnamed.c | 12 +++++++++++-
2 files changed, 26 insertions(+), 6 deletions(-)
Index: systemd-218/src/core/hostname-setup.c
===================================================================
--- systemd-218.orig/src/core/hostname-setup.c
+++ systemd-218/src/core/hostname-setup.c
@@ -61,12 +61,22 @@ int hostname_setup(void) {
r = read_and_strip_hostname("/etc/hostname", &b);
if (r < 0) {
- if (r == -ENOENT)
- enoent = true;
- else
+ 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;
+ }
+ } else {
log_warning_errno(r, "Failed to read configured hostname: %m");
-
- version 206 , highlights: * Unit files now understand the new %v specifier which resolves to the kernel version string as returned by "uname-r". * "journalctl -b" may now be used to look for boot output of a specific boot. Try "journalctl -b -1" * Creation of "dead" device nodes has been moved from udev into kmod and tmpfiles. * The udev "keymap" data files and tools to apply keyboard specific mappings of scan to key codes, and force-release scan code lists have been entirely replaced by a udev "keyboard" builtin and a hwdb data file. - remove patches now in upstream - systemd now requires libkmod >=14 and cryptsetup >= 1.6.0 - systemd now require the kmod tool in addition to the library. - version 206 , highlights: * Unit files now understand the new %v specifier which resolves to the kernel version string as returned by "uname-r". * "journalctl -b" may now be used to look for boot output of a specific boot. Try "journalctl -b -1" * Creation of "dead" device nodes has been moved from udev into kmod and tmpfiles. * The udev "keymap" data files and tools to apply keyboard specific mappings of scan to key codes, and force-release scan code lists have been entirely replaced by a udev "keyboard" builtin and a hwdb data file. - remove patches now in upstream - systemd now requires libkmod >=14 and cryptsetup >= 1.6.0 - systemd now require the kmod tool in addition to the library. (forwarded request 184035 from elvigia) OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=416
2013-07-23 11:21:21 +02:00
- hn = NULL;
+ hn = NULL;
+ }
} else
hn = b;
Index: systemd-218/src/hostname/hostnamed.c
===================================================================
--- systemd-218.orig/src/hostname/hostnamed.c
+++ systemd-218/src/hostname/hostnamed.c
@@ -124,6 +124,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;
}
@@ -295,6 +299,7 @@ static int context_update_kernel_hostnam
}
static int context_write_data_static_hostname(Context *c) {
+ int r;
assert(c);
@@ -305,7 +310,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_machine_info(Context *c) {