plugin/dbus.c: Register dbus-daemon as a service

This patch changes how the D-Bus plugin starts dbus-daemon, from being
started in the background to letting Finit start and monitor it.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson committed 2017-10-15 20:46:22 +02:00
1 parent 7d9f873b7c
commit 888ce56f3e
1 file changed
+9 -4
+9 -4
View File
@@ -28,11 +28,16 @@
#include "config.h" #include "config.h"
#include "helpers.h" #include "helpers.h"
#include "plugin.h" #include "plugin.h"
#include "service.h"
#define DAEMON "dbus-daemon"
#define ARGS " --nofork --system"
#define DESC " -- D-Bus message bus daemon"
static void setup(void *arg) static void setup(void *arg)
{ {
if (!whichp("dbus-daemon")) { if (!whichp(DAEMON)) {
_d("Skipping D-Bus plugin, dbus-daemon is not installed."); _d("Skipping D-Bus plugin, %s is not installed.", DAEMON);
return; return;
} }
@@ -47,8 +52,8 @@ static void setup(void *arg)
/* Clean up from any previous pre-bootstrap run */ /* Clean up from any previous pre-bootstrap run */
erase("/var/run/dbus/pid"); erase("/var/run/dbus/pid");
if (service_register(SVC_TYPE_SERVICE, "[S12345] " DAEMON ARGS DESC, NULL))
run_interactive("dbus-daemon --system", "Starting D-Bus"); _pe("Failed registering %s", DAEMON);
umask(022); umask(022);
} }