[systemd-commits] 2 commits - src/systemctl.c
Lennart Poettering
lennart at kemper.freedesktop.org
Fri Jul 23 17:51:51 PDT 2010
src/systemctl.c | 29 +++++++++++++++++++++--------
1 file changed, 21 insertions(+), 8 deletions(-)
New commits:
commit d5ca5f11857e87524f0b75a0959a74404f707f1a
Author: Lennart Poettering <lennart at poettering.net>
Date: Sat Jul 24 02:33:38 2010 +0200
telinit: forward to upstart, if not booted with systemd
diff --git a/src/systemctl.c b/src/systemctl.c
index d6b1fcd..1640a60 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);
commit ec7f7f20069028ee7acc189255637e42acbd8e32
Author: Lennart Poettering <lennart at poettering.net>
Date: Sat Jul 24 02:23:40 2010 +0200
systemctl: don't use the systemd bus to talk to upstart
diff --git a/src/systemctl.c b/src/systemctl.c
index 2ae8c27..d6b1fcd 100644
--- a/src/systemctl.c
+++ b/src/systemctl.c
@@ -4516,18 +4516,17 @@ static int reload_with_fallback(DBusConnection *bus) {
static int start_with_fallback(DBusConnection *bus) {
int r;
-
if (bus) {
/* First, try systemd via D-Bus. */
if ((r = start_unit(bus, NULL, 0)) > 0)
goto done;
-
- /* Hmm, talking to systemd via D-Bus didn't work. Then
- * let's try to talk to Upstart via D-Bus. */
- if ((r = talk_upstart()) > 0)
- goto done;
}
+ /* Hmm, talking to systemd via D-Bus didn't work. Then
+ * let's try to talk to Upstart via D-Bus. */
+ if ((r = talk_upstart()) > 0)
+ goto done;
+
/* Nothing else worked, so let's try
* /dev/initctl */
if ((r = talk_initctl()) != 0)
More information about the systemd-commits
mailing list