Commit edb9aaa8 authored by Lennart Poettering's avatar Lennart Poettering
Browse files

main: replace --running-as= by --session and --system do mimic related tools and D-Bus

parent eee4b05f
...@@ -10,7 +10,8 @@ HOWTO: ...@@ -10,7 +10,8 @@ HOWTO:
you need to add/change things. you need to add/change things.
1) Patch src/hostname-setup.c so that systemd knows where to 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 2) Check the unit files in units/ if they match your
distribution. Most likely you will have to make additions to distribution. Most likely you will have to make additions to
...@@ -23,11 +24,11 @@ HOWTO: ...@@ -23,11 +24,11 @@ HOWTO:
and you should be able to find the places where you need to and you should be able to find the places where you need to
add/change things. add/change things.
4) Try it out. Play around with 'systemd --test 4) Try it out. Play around with 'systemd --test --system' for
--running-as=init' for a test run of systemd without a test run of systemd without booting. This will read the unit
booting. This will read the unit files and print the initial files and print the initial transaction it would execute
transaction it would execute during boot-up. This will also during boot-up. This will also inform you about ordering loops
inform you about ordering loops and suchlike. and suchlike.
CONTRIBUTING UPSTREAM: CONTRIBUTING UPSTREAM:
We are interested in merging your changes upstream, if they We are interested in merging your changes upstream, if they
......
...@@ -135,17 +135,19 @@ ...@@ -135,17 +135,19 @@
<filename>default.target</filename>.</para></listitem> <filename>default.target</filename>.</para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><option>--running-as=</option></term> <term><option>--system</option></term>
<term><option>--session</option></term>
<listitem><para>Tell systemd to run in
a particular mode. Argument is one of <listitem><para>Tell systemd to run a
<option>system</option>, system instance (resp. session
<option>session</option>. Normally it instance), even if the process ID is
should not be necessary to pass this not 1 (resp. is 1), i.e. system is not
option, as systemd automatically (resp. is) run as init process.
detects the mode it is started Normally it should not be necessary to
in. This call is hence of little use pass these options, as systemd
except for automatically detects the mode it is
started in. These options are hence of
little use except for
debugging.</para></listitem> debugging.</para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
...@@ -466,7 +468,7 @@ ...@@ -466,7 +468,7 @@
when figuring out whether a service when figuring out whether a service
shall be enabled. Note that a service shall be enabled. Note that a service
unit with a native unit configuration 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 in the SysV runlevel link
farm.</para></listitem> farm.</para></listitem>
</varlistentry> </varlistentry>
......
...@@ -545,7 +545,8 @@ static int parse_argv(int argc, char *argv[]) { ...@@ -545,7 +545,8 @@ static int parse_argv(int argc, char *argv[]) {
ARG_LOG_COLOR, ARG_LOG_COLOR,
ARG_LOG_LOCATION, ARG_LOG_LOCATION,
ARG_UNIT, ARG_UNIT,
ARG_RUNNING_AS, ARG_SYSTEM,
ARG_SESSION,
ARG_TEST, ARG_TEST,
ARG_DUMP_CONFIGURATION_ITEMS, ARG_DUMP_CONFIGURATION_ITEMS,
ARG_DUMP_CORE, ARG_DUMP_CORE,
...@@ -562,7 +563,8 @@ static int parse_argv(int argc, char *argv[]) { ...@@ -562,7 +563,8 @@ static int parse_argv(int argc, char *argv[]) {
{ "log-color", optional_argument, NULL, ARG_LOG_COLOR }, { "log-color", optional_argument, NULL, ARG_LOG_COLOR },
{ "log-location", optional_argument, NULL, ARG_LOG_LOCATION }, { "log-location", optional_argument, NULL, ARG_LOG_LOCATION },
{ "unit", required_argument, NULL, ARG_UNIT }, { "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 }, { "test", no_argument, NULL, ARG_TEST },
{ "help", no_argument, NULL, 'h' }, { "help", no_argument, NULL, 'h' },
{ "dump-configuration-items", no_argument, NULL, ARG_DUMP_CONFIGURATION_ITEMS }, { "dump-configuration-items", no_argument, NULL, ARG_DUMP_CONFIGURATION_ITEMS },
...@@ -634,17 +636,13 @@ static int parse_argv(int argc, char *argv[]) { ...@@ -634,17 +636,13 @@ static int parse_argv(int argc, char *argv[]) {
break; break;
case ARG_RUNNING_AS: { case ARG_SYSTEM:
ManagerRunningAs as; arg_running_as = MANAGER_SYSTEM;
break;
if ((as = manager_running_as_from_string(optarg)) < 0) {
log_error("Failed to parse running as value %s", optarg);
return -EINVAL;
}
arg_running_as = as; case ARG_SESSION:
arg_running_as = MANAGER_SESSION;
break; break;
}
case ARG_TEST: case ARG_TEST:
arg_action = ACTION_TEST; arg_action = ACTION_TEST;
...@@ -746,7 +744,8 @@ static int help(void) { ...@@ -746,7 +744,8 @@ static int help(void) {
" --dump-configuration-items Dump understood unit configuration items\n" " --dump-configuration-items Dump understood unit configuration items\n"
" --introspect[=INTERFACE] Extract D-Bus interface data\n" " --introspect[=INTERFACE] Extract D-Bus interface data\n"
" --unit=UNIT Set default unit\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" " --dump-core Dump core on crash\n"
" --crash-shell Run shell on crash\n" " --crash-shell Run shell on crash\n"
" --confirm-spawn Ask for confirmation when spawning processes\n" " --confirm-spawn Ask for confirmation when spawning processes\n"
...@@ -1042,7 +1041,7 @@ finish: ...@@ -1042,7 +1041,7 @@ finish:
dbus_shutdown(); dbus_shutdown();
if (reexecute) { if (reexecute) {
const char *args[11]; const char *args[14];
unsigned i = 0; unsigned i = 0;
char sfd[16]; char sfd[16];
...@@ -1057,8 +1056,22 @@ finish: ...@@ -1057,8 +1056,22 @@ finish:
args[i++] = "--log-target"; args[i++] = "--log-target";
args[i++] = log_target_to_string(log_get_target()); args[i++] = log_target_to_string(log_get_target());
args[i++] = "--running-as"; if (arg_running_as == MANAGER_SYSTEM)
args[i++] = manager_running_as_to_string(arg_running_as); 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)); snprintf(sfd, sizeof(sfd), "%i", fileno(serialization));
char_array_0(sfd); char_array_0(sfd);
...@@ -1066,9 +1079,6 @@ finish: ...@@ -1066,9 +1079,6 @@ finish:
args[i++] = "--deserialize"; args[i++] = "--deserialize";
args[i++] = sfd; args[i++] = sfd;
if (arg_confirm_spawn)
args[i++] = "--confirm-spawn";
args[i++] = NULL; args[i++] = NULL;
assert(i <= ELEMENTSOF(args)); assert(i <= ELEMENTSOF(args));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment