ARG_SHOW_STATUS,
ARG_SYSV_CONSOLE,
ARG_DESERIALIZE,
+ ARG_SWITCHEDROOT,
ARG_INTROSPECT,
ARG_DEFAULT_STD_OUTPUT,
ARG_DEFAULT_STD_ERROR
{ "sysv-console", optional_argument, NULL, ARG_SYSV_CONSOLE },
#endif
{ "deserialize", required_argument, NULL, ARG_DESERIALIZE },
+ { "switchedroot", no_argument, NULL, ARG_SWITCHEDROOT },
{ "introspect", optional_argument, NULL, ARG_INTROSPECT },
{ "default-standard-output", required_argument, NULL, ARG_DEFAULT_STD_OUTPUT, },
{ "default-standard-error", required_argument, NULL, ARG_DEFAULT_STD_ERROR, },
break;
}
+ case ARG_SWITCHEDROOT:
+ /* Nothing special yet */
+ break;
+
case ARG_INTROSPECT: {
const char * const * i = NULL;
break;
}
+ /* If we have switched root, do all the special things */
+ for (j = 1; j < argc; j++)
+ if (streq(argv[j], "--switchedroot")) {
+ is_reexec = false;
+ break;
+ }
+
/* If we get started via the /sbin/init symlink then we are
called 'init'. After a subsequent reexecution we are then
called 'systemd'. That is confusing, hence let's call us
if (switch_root)
do_switch_root(switch_root);
- args_size = MAX(5, argc+1);
+ args_size = MAX(6, argc+1);
args = newa(const char*, args_size);
if (!switch_root_init) {
i = 0;
args[i++] = SYSTEMD_BINARY_PATH;
+ if (switch_root)
+ args[i++] = "--switchedroot";
args[i++] = arg_running_as == MANAGER_SYSTEM ? "--system" : "--user";
args[i++] = "--deserialize";
args[i++] = sfd;