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;
|
||
|
}
|
||
|
|
||
|
@@ -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) {
|