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
2017-10-15 20:46:22 +02:00
parent 7d9f873b7c
commit 888ce56f3e
+9 -4
View File
@@ -28,11 +28,16 @@
#include "config.h"
#include "helpers.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)
{
if (!whichp("dbus-daemon")) {
_d("Skipping D-Bus plugin, dbus-daemon is not installed.");
if (!whichp(DAEMON)) {
_d("Skipping D-Bus plugin, %s is not installed.", DAEMON);
return;
}
@@ -47,8 +52,8 @@ static void setup(void *arg)
/* Clean up from any previous pre-bootstrap run */
erase("/var/run/dbus/pid");
run_interactive("dbus-daemon --system", "Starting D-Bus");
if (service_register(SVC_TYPE_SERVICE, "[S12345] " DAEMON ARGS DESC, NULL))
_pe("Failed registering %s", DAEMON);
umask(022);
}