mirror of
https://github.com/troglobit/finit.git
synced 2026-11-06 15:51:03 +00:00
plugins: create missing d-bus directories
- Prefix plugin defines with DBUS_ to allow overriding at build-time - Create missing directories for modern d-bus Signed-off-by: Andy Savage <andy@savage.hk>
This commit is contained in:
1 parent
d11dc63bc2
commit
c129f06195
1 file changed
+23
-13
+23
-13
@@ -35,16 +35,20 @@
|
|||||||
#include "service.h"
|
#include "service.h"
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
|
|
||||||
#define DAEMON "dbus-daemon"
|
#define DBUS_DAEMON "dbus-daemon"
|
||||||
#define ARGS "--nofork --system --syslog-only"
|
#define DBUS_ARGS "--nofork --system --syslog-only"
|
||||||
#define DESC "D-Bus message bus daemon"
|
#define DBUS_DESC "D-Bus message bus daemon"
|
||||||
|
|
||||||
#ifndef DAEMONUSER
|
#ifndef DBUS_DAEMONUSER
|
||||||
#define DAEMONUSER "messagebus"
|
#define DBUS_DAEMONUSER "messagebus"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef DAEMONPIDFILE
|
#ifndef DBUS_DAEMONGROUP
|
||||||
#define DAEMONPIDFILE "/var/run/dbus/pid"
|
#define DBUS_DAEMONGROUP "messagebus"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef DBUS_DAEMONPIDFILE
|
||||||
|
#define DBUS_DAEMONPIDFILE "/var/run/dbus/pid"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void setup(void *arg)
|
static void setup(void *arg)
|
||||||
@@ -58,26 +62,32 @@ static void setup(void *arg)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd = which(DAEMON);
|
cmd = which(DBUS_DAEMON);
|
||||||
if (!cmd) {
|
if (!cmd) {
|
||||||
_d("Skipping plugin, %s is not installed.", DAEMON);
|
_d("Skipping plugin, %s is not installed.", DBUS_DAEMON);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
prev =umask(0);
|
prev =umask(0);
|
||||||
|
|
||||||
mksubsys("/var/run/dbus", 0755, DAEMONUSER, DAEMONUSER);
|
_d("Creating D-Bus Required Directories ...");
|
||||||
|
mksubsys("/var/run/dbus", 0755, DBUS_DAEMONUSER, DBUS_DAEMONGROUP);
|
||||||
|
mksubsys("/var/run/lock/subsys", 0755, DBUS_DAEMONUSER, DBUS_DAEMONGROUP);
|
||||||
|
mksubsys("/var/lib/dbus", 0755, DBUS_DAEMONUSER, DBUS_DAEMONGROUP);
|
||||||
|
mksubsys("/tmp/dbus", 0755, DBUS_DAEMONUSER, DBUS_DAEMONGROUP);
|
||||||
|
|
||||||
|
/* Generate machine id for dbus */
|
||||||
if (whichp("dbus-uuidgen"))
|
if (whichp("dbus-uuidgen"))
|
||||||
run_interactive("dbus-uuidgen --ensure", "Creating machine UUID for D-Bus");
|
run_interactive("dbus-uuidgen --ensure", "Creating machine UUID for D-Bus");
|
||||||
|
|
||||||
/* Clean up from any previous pre-bootstrap run */
|
/* Clean up from any previous pre-bootstrap run */
|
||||||
remove(DAEMONPIDFILE);
|
remove(DBUS_DAEMONPIDFILE);
|
||||||
|
|
||||||
/* Register service with Finit */
|
/* Register service with Finit */
|
||||||
snprintf(line, sizeof(line), "[S12345789] cgroup.system pid:!%s @%s:%s %s %s -- %s",
|
snprintf(line, sizeof(line), "[S12345789] cgroup.system pid:!%s @%s:%s %s %s -- %s",
|
||||||
DAEMONPIDFILE, DAEMONUSER, DAEMONUSER, cmd, ARGS, DESC);
|
DBUS_DAEMONPIDFILE, DBUS_DAEMONUSER, DBUS_DAEMONGROUP, cmd, DBUS_ARGS, DBUS_DESC);
|
||||||
if (service_register(SVC_TYPE_SERVICE, line, global_rlimit, NULL))
|
if (service_register(SVC_TYPE_SERVICE, line, global_rlimit, NULL))
|
||||||
_pe("Failed registering %s", DAEMON);
|
_pe("Failed registering %s", DBUS_DAEMON);
|
||||||
free(cmd);
|
free(cmd);
|
||||||
|
|
||||||
umask(prev);
|
umask(prev);
|
||||||
|
|||||||
Reference in new issue
Block a user