Merge pull request #91232 from primeos/systemd-allow-transient-hostname
systemd: Allow setting the transient hostname via DHCP
This commit is contained in:
commit
12834b3e87
2 changed files with 5 additions and 10 deletions
|
@ -97,6 +97,11 @@ import ./make-test-python.nix ({ pkgs, ... }: {
|
|||
re.search(r"^Filesystem state: *clean$", extinfo, re.MULTILINE) is not None
|
||||
), ("File system was not cleanly unmounted: " + extinfo)
|
||||
|
||||
# Regression test for https://github.com/NixOS/nixpkgs/pull/91232
|
||||
with subtest("setting transient hostnames works"):
|
||||
machine.succeed("hostnamectl set-hostname --transient machine-transient")
|
||||
machine.fail("hostnamectl set-hostname machine-all")
|
||||
|
||||
with subtest("systemd-shutdown works"):
|
||||
machine.shutdown()
|
||||
machine.wait_for_unit("multi-user.target")
|
||||
|
|
|
@ -14,16 +14,6 @@ diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c
|
|||
index 21f6471495..8c5af7619f 100644
|
||||
--- a/src/hostname/hostnamed.c
|
||||
+++ b/src/hostname/hostnamed.c
|
||||
@@ -422,6 +422,9 @@ static int method_set_hostname(sd_bus_message *m, void *userdata, sd_bus_error *
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
+ return sd_bus_error_setf(error, SD_BUS_ERROR_NOT_SUPPORTED,
|
||||
+ "Changing system settings via systemd is not supported on NixOS.");
|
||||
+
|
||||
if (isempty(name))
|
||||
name = c->data[PROP_STATIC_HOSTNAME];
|
||||
|
||||
@@ -478,6 +481,9 @@ static int method_set_static_hostname(sd_bus_message *m, void *userdata, sd_bus_
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
|
Loading…
Reference in a new issue