]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
machinectl: also enable machines.target when enabling machines
authorMike Yuan <me@yhndnzj.com>
Mon, 23 Jan 2023 16:13:23 +0000 (00:13 +0800)
committerMike Yuan <me@yhndnzj.com>
Mon, 23 Jan 2023 16:13:23 +0000 (00:13 +0800)
It's mostly desired to enable machines.target
along with the machine since only when both are
enabled it would really work.

src/machine/machinectl.c

index 149b5d8e60976a585c29546220dbe299ebaedc1f..b9e3848d1826bc763825979985b28721db0e6014 100644 (file)
@@ -1616,6 +1616,12 @@ static int enable_machine(int argc, char *argv[], void *userdata) {
         if (r < 0)
                 return bus_log_create_error(r);
 
+        if (streq(argv[0], "enable")) {
+                r = sd_bus_message_append(m, "s", "machines.target");
+                if (r < 0)
+                        return bus_log_create_error(r);
+        }
+
         for (int i = 1; i < argc; i++) {
                 _cleanup_free_ char *unit = NULL;