[systemd-devel] [PATCH] Make upstart compatibility optional

Cristian Rodríguez crrodriguez at opensuse.org
Fri Sep 27 12:24:50 PDT 2013


Distributions such as openSUSE and probably others never included
upstart, in that case there is no need to include this code.

This introduces --disable-upstartcompat, however upstart compat is still
enabled by default.
---
 configure.ac              | 3 +++
 src/systemctl/systemctl.c | 5 +++++
 2 files changed, 8 insertions(+)

diff --git a/configure.ac b/configure.ac
index 45526f4..f234a21 100644
--- a/configure.ac
+++ b/configure.ac
@@ -766,6 +766,9 @@ if test "x$enable_efi" != "xno"; then
 fi
 AM_CONDITIONAL(ENABLE_EFI, [test "x$have_efi" = "xyes"])
 
+AC_ARG_ENABLE(upstartcompat, AS_HELP_STRING([--disable-upstartcompat], [disable upstart compatibility]))
+AS_IF([test "x$enable_upstartcompat" != "xno"], [AC_DEFINE([UPSTART_COMPAT], [1], [Upstart compat])])
+
 # ------------------------------------------------------------------------------
 AC_ARG_WITH(rc-local-script-path-start,
         AS_HELP_STRING([--with-rc-local-script-path-start=PATH],
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index eede616..c784f3e 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -5678,6 +5678,7 @@ _pure_ static int action_to_runlevel(void) {
         return table[arg_action];
 }
 
+#ifdef UPSTART_COMPAT
 static int talk_upstart(void) {
         _cleanup_dbus_message_unref_ DBusMessage *m = NULL, *reply = NULL;
         _cleanup_dbus_error_free_ DBusError error;
@@ -5766,6 +5767,8 @@ finish:
         return r;
 }
 
+#endif
+
 static int talk_initctl(void) {
         struct init_request request = {};
         int r;
@@ -6037,10 +6040,12 @@ static int start_with_fallback(DBusConnection *bus) {
                         goto done;
         }
 
+#ifdef UPSTART_COMPAT
         /* Hmm, talking to systemd via D-Bus didn't work. Then
          * let's try to talk to Upstart via D-Bus. */
         if (talk_upstart() > 0)
                 goto done;
+#endif
 
         /* Nothing else worked, so let's try
          * /dev/initctl */
-- 
1.8.4



More information about the systemd-devel mailing list