diff options
author | Lennart Poettering <lennart@poettering.net> | 2010-07-13 18:57:58 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2010-07-13 18:57:58 +0200 |
commit | edb9aaa8b27adf89cc712000318b1e9cf40ea296 (patch) | |
tree | 903ab16a52390bf09ca3dfefae0d148179d42dbd | |
parent | eee4b05fab0a26aab7b8dc1e0e11e4a624a15798 (diff) |
main: replace --running-as= by --session and --system do mimic related tools and D-Bus
-rw-r--r-- | DISTRO_PORTING | 13 | ||||
-rw-r--r-- | man/systemd.xml | 26 | ||||
-rw-r--r-- | src/main.c | 46 |
3 files changed, 49 insertions, 36 deletions
diff --git a/DISTRO_PORTING b/DISTRO_PORTING index fedbc0e3e4..2b08bf8116 100644 --- a/DISTRO_PORTING +++ b/DISTRO_PORTING @@ -10,7 +10,8 @@ HOWTO: you need to add/change things. 1) Patch src/hostname-setup.c so that systemd knows where to - read your host name from. + read your host name from. You might also want to update + status_welcome() in util.c. 2) Check the unit files in units/ if they match your distribution. Most likely you will have to make additions to @@ -23,11 +24,11 @@ HOWTO: and you should be able to find the places where you need to add/change things. - 4) Try it out. Play around with 'systemd --test - --running-as=init' for a test run of systemd without - booting. This will read the unit files and print the initial - transaction it would execute during boot-up. This will also - inform you about ordering loops and suchlike. + 4) Try it out. Play around with 'systemd --test --system' for + a test run of systemd without booting. This will read the unit + files and print the initial transaction it would execute + during boot-up. This will also inform you about ordering loops + and suchlike. CONTRIBUTING UPSTREAM: We are interested in merging your changes upstream, if they diff --git a/man/systemd.xml b/man/systemd.xml index 0798f231b9..d19094c38f 100644 --- a/man/systemd.xml +++ b/man/systemd.xml @@ -135,17 +135,19 @@ <filename>default.target</filename>.</para></listitem> </varlistentry> <varlistentry> - <term><option>--running-as=</option></term> - - <listitem><para>Tell systemd to run in - a particular mode. Argument is one of - <option>system</option>, - <option>session</option>. Normally it - should not be necessary to pass this - option, as systemd automatically - detects the mode it is started - in. This call is hence of little use - except for + <term><option>--system</option></term> + <term><option>--session</option></term> + + <listitem><para>Tell systemd to run a + system instance (resp. session + instance), even if the process ID is + not 1 (resp. is 1), i.e. system is not + (resp. is) run as init process. + Normally it should not be necessary to + pass these options, as systemd + automatically detects the mode it is + started in. These options are hence of + little use except for debugging.</para></listitem> </varlistentry> <varlistentry> @@ -466,7 +468,7 @@ when figuring out whether a service shall be enabled. Note that a service unit with a native unit configuration - file can be started by activating it + file cannot be started by activating it in the SysV runlevel link farm.</para></listitem> </varlistentry> diff --git a/src/main.c b/src/main.c index 9f2a569029..27ad4c4c80 100644 --- a/src/main.c +++ b/src/main.c @@ -545,7 +545,8 @@ static int parse_argv(int argc, char *argv[]) { ARG_LOG_COLOR, ARG_LOG_LOCATION, ARG_UNIT, - ARG_RUNNING_AS, + ARG_SYSTEM, + ARG_SESSION, ARG_TEST, ARG_DUMP_CONFIGURATION_ITEMS, ARG_DUMP_CORE, @@ -562,7 +563,8 @@ static int parse_argv(int argc, char *argv[]) { { "log-color", optional_argument, NULL, ARG_LOG_COLOR }, { "log-location", optional_argument, NULL, ARG_LOG_LOCATION }, { "unit", required_argument, NULL, ARG_UNIT }, - { "running-as", required_argument, NULL, ARG_RUNNING_AS }, + { "system", no_argument, NULL, ARG_SYSTEM }, + { "session", no_argument, NULL, ARG_SESSION }, { "test", no_argument, NULL, ARG_TEST }, { "help", no_argument, NULL, 'h' }, { "dump-configuration-items", no_argument, NULL, ARG_DUMP_CONFIGURATION_ITEMS }, @@ -634,17 +636,13 @@ static int parse_argv(int argc, char *argv[]) { break; - case ARG_RUNNING_AS: { - ManagerRunningAs as; - - if ((as = manager_running_as_from_string(optarg)) < 0) { - log_error("Failed to parse running as value %s", optarg); - return -EINVAL; - } + case ARG_SYSTEM: + arg_running_as = MANAGER_SYSTEM; + break; - arg_running_as = as; + case ARG_SESSION: + arg_running_as = MANAGER_SESSION; break; - } case ARG_TEST: arg_action = ACTION_TEST; @@ -746,7 +744,8 @@ static int help(void) { " --dump-configuration-items Dump understood unit configuration items\n" " --introspect[=INTERFACE] Extract D-Bus interface data\n" " --unit=UNIT Set default unit\n" - " --running-as=AS Set running as (system, session)\n" + " --system Run a system instance, even if PID != 1\n" + " --session Run a session instance\n" " --dump-core Dump core on crash\n" " --crash-shell Run shell on crash\n" " --confirm-spawn Ask for confirmation when spawning processes\n" @@ -1042,7 +1041,7 @@ finish: dbus_shutdown(); if (reexecute) { - const char *args[11]; + const char *args[14]; unsigned i = 0; char sfd[16]; @@ -1057,8 +1056,22 @@ finish: args[i++] = "--log-target"; args[i++] = log_target_to_string(log_get_target()); - args[i++] = "--running-as"; - args[i++] = manager_running_as_to_string(arg_running_as); + if (arg_running_as == MANAGER_SYSTEM) + args[i++] = "--system"; + else + args[i++] = "--session"; + + if (arg_dump_core) + args[i++] = "--dump-core"; + + if (arg_crash_shell) + args[i++] = "--crash-shell"; + + if (arg_confirm_spawn) + args[i++] = "--confirm-spawn"; + + if (arg_show_status) + args[i++] = "--show-status"; snprintf(sfd, sizeof(sfd), "%i", fileno(serialization)); char_array_0(sfd); @@ -1066,9 +1079,6 @@ finish: args[i++] = "--deserialize"; args[i++] = sfd; - if (arg_confirm_spawn) - args[i++] = "--confirm-spawn"; - args[i++] = NULL; assert(i <= ELEMENTSOF(args)); |