summaryrefslogtreecommitdiff
path: root/src/systemctl.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-07-24 02:33:38 +0200
committerLennart Poettering <lennart@poettering.net>2010-07-24 02:33:38 +0200
commitd5ca5f11857e87524f0b75a0959a74404f707f1a (patch)
tree953089fa5df626bf54f30f92cae345953bb585f5 /src/systemctl.c
parentec7f7f20069028ee7acc189255637e42acbd8e32 (diff)
telinit: forward to upstart, if not booted with systemdsystemd/v4
Diffstat (limited to 'src/systemctl.c')
-rw-r--r--src/systemctl.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/systemctl.c b/src/systemctl.c
index d6b1fcd581..1640a60a70 100644
--- a/src/systemctl.c
+++ b/src/systemctl.c
@@ -4209,8 +4209,22 @@ static int parse_argv(int argc, char *argv[]) {
arg_action = ACTION_POWEROFF;
return shutdown_parse_argv(argc, argv);
} else if (strstr(program_invocation_short_name, "init")) {
- arg_action = ACTION_INVALID;
- return telinit_parse_argv(argc, argv);
+
+ if (sd_booted() > 0) {
+ arg_action = ACTION_INVALID;
+ return telinit_parse_argv(argc, argv);
+ } else {
+ /* Hmm, so some other init system is
+ * running, we need to forward this
+ * request to it. For now we simply
+ * guess that it is Upstart. */
+
+ execv("/lib/upstart/telinit", argv);
+
+ log_error("Couldn't find an alternative telinit implementation to spawn.");
+ return -EIO;
+ }
+
} else if (strstr(program_invocation_short_name, "runlevel")) {
arg_action = ACTION_RUNLEVEL;
return runlevel_parse_argv(argc, argv);