X Tutup
Skip to content

Commit cbdc294

Browse files
anitazhabluca
authored andcommitted
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.
1 parent a2031de commit cbdc294

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/run/run.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -576,13 +576,13 @@ static int parse_argv(int argc, char *argv[]) {
576576
} else if (!arg_unit || !with_trigger)
577577
return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Command line to execute required.");
578578

579-
if (arg_user && arg_transport != BUS_TRANSPORT_LOCAL)
579+
if (arg_user && arg_transport == BUS_TRANSPORT_REMOTE)
580580
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
581-
"Execution in user context is not supported on non-local systems.");
581+
"Execution in user context is not supported on remote systems.");
582582

583-
if (arg_scope && arg_transport != BUS_TRANSPORT_LOCAL)
583+
if (arg_scope && arg_transport == BUS_TRANSPORT_REMOTE)
584584
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
585-
"Scope execution is not supported on non-local systems.");
585+
"Scope execution is not supported on remote systems.");
586586

587587
if (arg_scope && (arg_remain_after_exit || arg_service_type))
588588
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
@@ -1754,7 +1754,7 @@ static int run(int argc, char* argv[]) {
17541754

17551755
/* If --wait is used connect via the bus, unconditionally, as ref/unref is not supported via the limited direct
17561756
* connection */
1757-
if (arg_wait || arg_stdio != ARG_STDIO_NONE)
1757+
if (arg_wait || arg_stdio != ARG_STDIO_NONE || (arg_user && arg_transport != BUS_TRANSPORT_LOCAL))
17581758
r = bus_connect_transport(arg_transport, arg_host, arg_user, &bus);
17591759
else
17601760
r = bus_connect_transport_systemd(arg_transport, arg_host, arg_user, &bus);

0 commit comments

Comments
 (0)
X Tutup