summaryrefslogtreecommitdiff
path: root/src/run
diff options
context:
space:
mode:
authorAnita Zhang <the.anitazha@gmail.com>2021-05-13 01:17:51 -0700
committerLuca Boccassi <luca.boccassi@gmail.com>2021-05-13 16:49:06 +0100
commitcbdc29492097e24ef3320280bc2a8dedbce02d9a (patch)
treefcc807e8d0f24d90522f548b387da093ec4650d3 /src/run
parenta2031de849da52aa85b7e4326c0112ed7e5b5672 (diff)
downloadsystemd-cbdc29492097e24ef3320280bc2a8dedbce02d9a.tar.gz
run: update checks to allow running with a user's bus
systemd-run is documented to as being able to connect and run on a specific user bus with "--user --machine=lennart@.host" arguments. This PR updates some logic that prevented this from working.
Diffstat (limited to 'src/run')
-rw-r--r--src/run/run.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/run/run.c b/src/run/run.c
index ac405d39d7..555f0584c8 100644
--- a/src/run/run.c
+++ b/src/run/run.c
@@ -576,13 +576,13 @@ static int parse_argv(int argc, char *argv[]) {
} else if (!arg_unit || !with_trigger)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Command line to execute required.");
- if (arg_user && arg_transport != BUS_TRANSPORT_LOCAL)
+ if (arg_user && arg_transport == BUS_TRANSPORT_REMOTE)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
- "Execution in user context is not supported on non-local systems.");
+ "Execution in user context is not supported on remote systems.");
- if (arg_scope && arg_transport != BUS_TRANSPORT_LOCAL)
+ if (arg_scope && arg_transport == BUS_TRANSPORT_REMOTE)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
- "Scope execution is not supported on non-local systems.");
+ "Scope execution is not supported on remote systems.");
if (arg_scope && (arg_remain_after_exit || arg_service_type))
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
@@ -1754,7 +1754,7 @@ static int run(int argc, char* argv[]) {
/* If --wait is used connect via the bus, unconditionally, as ref/unref is not supported via the limited direct
* connection */
- if (arg_wait || arg_stdio != ARG_STDIO_NONE)
+ if (arg_wait || arg_stdio != ARG_STDIO_NONE || (arg_user && arg_transport != BUS_TRANSPORT_LOCAL))
r = bus_connect_transport(arg_transport, arg_host, arg_user, &bus);
else
r = bus_connect_transport_systemd(arg_transport, arg_host, arg_user, &bus);