if (arg_runtime_scope != RUNTIME_SCOPE_SYSTEM)
extra_args[n++] = "--user";
- if (arg_transport == BUS_TRANSPORT_REMOTE) {
+ switch (arg_transport) {
+
+ case BUS_TRANSPORT_REMOTE:
extra_args[n++] = "-H";
extra_args[n++] = arg_host;
- } else if (arg_transport == BUS_TRANSPORT_MACHINE) {
+ break;
+
+ case BUS_TRANSPORT_MACHINE:
extra_args[n++] = "-M";
extra_args[n++] = arg_host;
- } else
- assert(arg_transport == BUS_TRANSPORT_LOCAL);
+ break;
+
+ case BUS_TRANSPORT_CAPSULE:
+ extra_args[n++] = "-C";
+ extra_args[n++] = arg_host;
+ break;
+
+ case BUS_TRANSPORT_LOCAL:
+ break;
+
+ default:
+ assert_not_reached();
+ }
extra_args[n] = NULL;
return extra_args;
#include "path-util.h"
#include "pretty-print.h"
#include "process-util.h"
+#include "capsule-util.h"
#include "reboot-util.h"
#include "rlimit-util.h"
#include "sigbus.h"
#include "systemctl.h"
#include "terminal-util.h"
#include "time-util.h"
+#include "user-util.h"
#include "verbs.h"
#include "virt.h"
" --version Show package version\n"
" --system Connect to system manager\n"
" --user Connect to user service manager\n"
+ " -C --capsule=NAME Connect to service manager of specified capsule\n"
" -H --host=[USER@]HOST Operate on remote host\n"
" -M --machine=CONTAINER Operate on a local container\n"
" -t --type=TYPE List units of a particular type\n"
{ "user", no_argument, NULL, ARG_USER },
{ "system", no_argument, NULL, ARG_SYSTEM },
{ "global", no_argument, NULL, ARG_GLOBAL },
+ { "capsule", required_argument, NULL, 'C' },
{ "wait", no_argument, NULL, ARG_WAIT },
{ "no-block", no_argument, NULL, ARG_NO_BLOCK },
{ "legend", required_argument, NULL, ARG_LEGEND },
/* We default to allowing interactive authorization only in systemctl (not in the legacy commands) */
arg_ask_password = true;
- while ((c = getopt_long(argc, argv, "ht:p:P:alqfs:H:M:n:o:iTr.::", options, NULL)) >= 0)
+ while ((c = getopt_long(argc, argv, "hC:t:p:P:alqfs:H:M:n:o:iTr.::", options, NULL)) >= 0)
switch (c) {
arg_runtime_scope = RUNTIME_SCOPE_GLOBAL;
break;
+ case 'C':
+ r = capsule_name_is_valid(optarg);
+ if (r < 0)
+ return log_error_errno(r, "Unable to validate capsule name '%s': %m", optarg);
+ if (r == 0)
+ return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Invalid capsule name: %s", optarg);
+
+ arg_host = optarg;
+ arg_transport = BUS_TRANSPORT_CAPSULE;
+ arg_runtime_scope = RUNTIME_SCOPE_USER;
+ break;
+
case ARG_WAIT:
arg_wait = true;
break;