diff options
author | Lennart Poettering <lennart@poettering.net> | 2016-02-15 23:07:24 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2016-02-15 23:07:24 +0100 |
commit | a6b8530aecfa4df0debb0dd89ed089053d3fc926 (patch) | |
tree | 52cf280d998faae52183f42677b30d8cf01c4f5e /src/systemctl/systemctl.c | |
parent | 11ab173d4067a4ed6fab811ba2159456053fd4c1 (diff) | |
parent | 4524439edb7d6050ba8a7779cdb7305e6ceb621c (diff) |
Merge pull request #2622 from keszybz/systemctl-m-h
systemctl: include -M or -H arguments in the hint
Diffstat (limited to 'src/systemctl/systemctl.c')
-rw-r--r-- | src/systemctl/systemctl.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index 908ccabf8a..44c13cf4d7 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -2778,9 +2778,23 @@ static int start_unit(int argc, char *argv[], void *userdata) { } if (!arg_no_block) { - int q; + int q, arg_count = 1; + const char* extra_args[5] = {NULL}; + + /* leave first empty for the actual command name*/ + if (arg_scope != UNIT_FILE_SYSTEM) + extra_args[arg_count++] = "--user"; + + assert(IN_SET(arg_transport, BUS_TRANSPORT_LOCAL, BUS_TRANSPORT_REMOTE, BUS_TRANSPORT_MACHINE)); + if (arg_transport == BUS_TRANSPORT_REMOTE) { + extra_args[arg_count++] = "-H"; + extra_args[arg_count++] = arg_host; + } else if (arg_transport == BUS_TRANSPORT_MACHINE) { + extra_args[arg_count++] = "-M"; + extra_args[arg_count++] = arg_host; + } - q = bus_wait_for_jobs(w, arg_quiet, arg_scope != UNIT_FILE_SYSTEM ? "--user" : NULL); + q = bus_wait_for_jobs(w, arg_quiet, extra_args); if (q < 0) return q; |