]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
run: support --system to match other commands, even if redundant
authorLennart Poettering <lennart@poettering.net>
Wed, 6 Nov 2013 16:31:20 +0000 (17:31 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 6 Nov 2013 16:31:20 +0000 (17:31 +0100)
man/systemd-run.xml
src/run/run.c

index cc8a68a0227dc369b5f05dfe90ae3c7c40719121..031c207cc3ceab0188fb60971d7b616675200af2 100644 (file)
@@ -112,6 +112,15 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
         </listitem>
       </varlistentry>
 
+      <varlistentry>
+        <term><option>--system</option></term>
+
+        <listitem>
+          <para>Talk to the service manager of the system. This is the
+          implied default.</para>
+        </listitem>
+      </varlistentry>
+
       <varlistentry>
               <term><option>-H</option></term>
               <term><option>--host=</option></term>
index fc7a3fc521ecfb85f1d9e98b3f340378874e3bb0..567fd97e3c2536d47572acb205ad5b9ce645a74b 100644 (file)
@@ -46,8 +46,8 @@ static int help(void) {
                "  -h --help               Show this help\n"
                "     --version            Show package version\n"
                "     --user               Run as user unit\n"
-               "  -H --host=[USER@]HOST  Operate on remote host\n"
-               "  -M --machine=CONTAINER Operate on local container\n"
+               "  -H --host=[USER@]HOST   Operate on remote host\n"
+               "  -M --machine=CONTAINER  Operate on local container\n"
                "     --scope              Run this as scope rather than service\n"
                "     --unit=UNIT          Run under the specified unit name\n"
                "     --description=TEXT   Description for unit\n"
@@ -64,6 +64,7 @@ static int parse_argv(int argc, char *argv[]) {
         enum {
                 ARG_VERSION = 0x100,
                 ARG_USER,
+                ARG_SYSTEM,
                 ARG_SCOPE,
                 ARG_UNIT,
                 ARG_DESCRIPTION,
@@ -75,6 +76,7 @@ static int parse_argv(int argc, char *argv[]) {
                 { "help",              no_argument,       NULL, 'h'             },
                 { "version",           no_argument,       NULL, ARG_VERSION     },
                 { "user",              no_argument,       NULL, ARG_USER        },
+                { "system",            no_argument,       NULL, ARG_SYSTEM      },
                 { "scope",             no_argument,       NULL, ARG_SCOPE       },
                 { "unit",              required_argument, NULL, ARG_UNIT        },
                 { "description",       required_argument, NULL, ARG_DESCRIPTION },
@@ -108,6 +110,10 @@ static int parse_argv(int argc, char *argv[]) {
                         arg_user = true;
                         break;
 
+                case ARG_SYSTEM:
+                        arg_user = false;
+                        break;
+
                 case ARG_SCOPE:
                         arg_scope = true;
                         break;
@@ -358,12 +364,12 @@ int main(int argc, char* argv[]) {
 
         r = parse_argv(argc, argv);
         if (r <= 0)
-                goto fail;
+                goto finish;
 
         r = find_binary(argv[optind], &command);
         if (r < 0) {
                 log_error("Failed to find executable %s: %s", argv[optind], strerror(-r));
-                goto fail;
+                goto finish;
         }
         argv[optind] = command;
 
@@ -371,7 +377,7 @@ int main(int argc, char* argv[]) {
                 description = strv_join(argv + optind, " ");
                 if (!description) {
                         r = log_oom();
-                        goto fail;
+                        goto finish;
                 }
 
                 arg_description = description;
@@ -380,7 +386,7 @@ int main(int argc, char* argv[]) {
         r = bus_open_transport(arg_transport, arg_host, arg_user, &bus);
         if (r < 0) {
                 log_error("Failed to create bus connection: %s", strerror(-r));
-                goto fail;
+                goto finish;
         }
 
         if (arg_scope)
@@ -390,9 +396,9 @@ int main(int argc, char* argv[]) {
         if (r < 0) {
                 log_error("Failed start transient unit: %s", error.message ? error.message : strerror(-r));
                 sd_bus_error_free(&error);
-                goto fail;
+                goto finish;
         }
 
-fail:
+finish:
         return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
 }