systemd/handle-HOSTNAME.patch
Robert Milasan 96bd006b89 Accepting request 155556 from home:fcrozat:branches:Base:System
- Add early-sync-shutdown.patch: start sync just when
  shutdown.target is beginning
- Update parse-multiline-env-file.patch to better handle continuing
  lines.
- Add handle-HOSTNAME.patch: handle /etc/HOSTNAME (bnc#803653).
- Add systemctl-print-wall-on-if-successful.patch: only print on
  wall if successful.
- Add improve-bash-completion.patch: improve bash completion.

OBS-URL: https://build.opensuse.org/request/show/155556
OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=348
2013-02-16 09:43:26 +00:00

37 lines
1.1 KiB
Diff

Index: systemd-195/src/hostname/hostnamed.c
===================================================================
--- systemd-195.orig/src/hostname/hostnamed.c
+++ systemd-195/src/hostname/hostnamed.c
@@ -118,6 +118,10 @@ static int read_data(void) {
if (r < 0 && r != -ENOENT)
return r;
+ r = read_one_line_file("/etc/HOSTNAME", &data[PROP_STATIC_HOSTNAME]);
+ if (r < 0 && r != -ENOENT)
+ return r;
+
return 0;
}
@@ -203,6 +207,7 @@ static int write_data_hostname(void) {
static int write_data_static_hostname(void) {
+ int r;
if (isempty(data[PROP_STATIC_HOSTNAME])) {
if (unlink("/etc/hostname") < 0)
@@ -211,7 +216,11 @@ static int write_data_static_hostname(vo
return 0;
}
- return write_one_line_file_atomic("/etc/hostname", data[PROP_STATIC_HOSTNAME]);
+ r = write_one_line_file_atomic("/etc/hostname", data[PROP_STATIC_HOSTNAME]);
+ if (!r) {
+ r = symlink_atomic("/etc/hostname", "/etc/HOSTNAME");
+ }
+ return r;
}
static int write_data_other(void) {