summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuca Boccassi <luca.boccassi@microsoft.com>2021-03-05 14:53:20 +0000
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-03-12 16:25:01 +0100
commitce77d3e14cec41e73f2c75181995b2d645ece136 (patch)
tree383b2c260022070ee556a6322b48d24ca32038b7
parentbe3d7af3a544415da496e433d923e3d8f80549b4 (diff)
downloadsystemd-ce77d3e14cec41e73f2c75181995b2d645ece136.tar.gz
portablectl: start/stop path/timer units too
Partial backport from: https://github.com/systemd/systemd/commit/e26fe5f91158a0d9133e61347650dfb73aadd6bb
-rw-r--r--src/portable/portablectl.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/portable/portablectl.c b/src/portable/portablectl.c
index 11c719a37a..554d099588 100644
--- a/src/portable/portablectl.c
+++ b/src/portable/portablectl.c
@@ -45,6 +45,10 @@ static bool arg_enable = false;
static bool arg_now = false;
static bool arg_no_block = false;
+static bool is_portable_managed(const char *unit) {
+ return ENDSWITH_SET(unit, ".service", ".target", ".socket", ".path", ".timer");
+}
+
static int determine_image(const char *image, bool permit_non_existing, char **ret) {
int r;
@@ -511,7 +515,7 @@ static int maybe_enable_start(sd_bus *bus, sd_bus_message *reply) {
if (r == 0)
break;
- if (STR_IN_SET(type, "symlink", "copy") && ENDSWITH_SET(path, ".service", ".target", ".socket")) {
+ if (STR_IN_SET(type, "symlink", "copy") && is_portable_managed(path)) {
(void) maybe_enable_disable(bus, path, true);
(void) maybe_start_stop(bus, path, true, wait);
}