|
|
923a60 |
From 10bf9c070764d09a4b39aa65ccba8b7501918a34 Mon Sep 17 00:00:00 2001
|
|
|
923a60 |
From: Jan Synacek <jan.synacek@gmail.com>
|
|
|
923a60 |
Date: Wed, 8 Feb 2017 20:57:08 +0100
|
|
|
923a60 |
Subject: [PATCH] systemctl: make sure that --now is carried out (#5209)
|
|
|
923a60 |
|
|
|
923a60 |
When services are already enabled/disabled/masked, make sure
|
|
|
923a60 |
that --now still enforces start/stop.
|
|
|
923a60 |
(cherry picked from commit 6bc30691b109302d386007c6bdabcc27d04991bc)
|
|
|
923a60 |
Resolves: #1417459
|
|
|
923a60 |
---
|
|
|
923a60 |
src/systemctl/systemctl.c | 20 ++++++++++++--------
|
|
|
923a60 |
1 file changed, 12 insertions(+), 8 deletions(-)
|
|
|
923a60 |
|
|
|
923a60 |
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
|
|
|
923a60 |
index ff8b4e9782..0333599c87 100644
|
|
|
923a60 |
--- a/src/systemctl/systemctl.c
|
|
|
923a60 |
+++ b/src/systemctl/systemctl.c
|
|
|
923a60 |
@@ -5549,16 +5549,20 @@ static int enable_unit(sd_bus *bus, char **args) {
|
|
|
923a60 |
"3) A unit may be started when needed via activation (socket, path, timer,\n"
|
|
|
923a60 |
" D-Bus, udev, scripted systemctl call, ...).\n");
|
|
|
923a60 |
|
|
|
923a60 |
- if (arg_now && n_changes > 0 && STR_IN_SET(args[0], "enable", "disable", "mask")) {
|
|
|
923a60 |
- char *new_args[n_changes + 2];
|
|
|
923a60 |
- unsigned i;
|
|
|
923a60 |
+ if (arg_now && STR_IN_SET(args[0], "enable", "disable", "mask")) {
|
|
|
923a60 |
+ unsigned len, i;
|
|
|
923a60 |
|
|
|
923a60 |
- new_args[0] = streq(args[0], "enable") ? (char *)"start" : (char *)"stop";
|
|
|
923a60 |
- for (i = 0; i < n_changes; i++)
|
|
|
923a60 |
- new_args[i + 1] = basename(changes[i].path);
|
|
|
923a60 |
- new_args[i + 1] = NULL;
|
|
|
923a60 |
+ len = strv_length(names);
|
|
|
923a60 |
+ {
|
|
|
923a60 |
+ char *new_args[len + 2];
|
|
|
923a60 |
|
|
|
923a60 |
- r = start_unit(bus, new_args);
|
|
|
923a60 |
+ new_args[0] = (char*) (streq(args[0], "enable") ? "start" : "stop");
|
|
|
923a60 |
+ for (i = 0; i < len; i++)
|
|
|
923a60 |
+ new_args[i + 1] = basename(names[i]);
|
|
|
923a60 |
+ new_args[i + 1] = NULL;
|
|
|
923a60 |
+
|
|
|
923a60 |
+ r = start_unit(bus, new_args);
|
|
|
923a60 |
+ }
|
|
|
923a60 |
}
|
|
|
923a60 |
|
|
|
923a60 |
finish:
|