forked from pool/systemd
3283fdeb6b
add: 1026-re-add-persistent-net.patch - rebase all patches, ensure that they apply properly. OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=357
37 lines
1.1 KiB
Diff
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;
|
|
}
|
|
|
|
@@ -204,6 +208,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)
|
|
@@ -212,7 +217,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) {
|