summaryrefslogtreecommitdiffstats
path: root/remote/modules/dbus
diff options
context:
space:
mode:
Diffstat (limited to 'remote/modules/dbus')
-rw-r--r--remote/modules/dbus/data/etc/systemd/system/dbus.socket5
-rw-r--r--remote/modules/dbus/dbus.build21
-rw-r--r--remote/modules/dbus/templates/dbus.service11
3 files changed, 34 insertions, 3 deletions
diff --git a/remote/modules/dbus/data/etc/systemd/system/dbus.socket b/remote/modules/dbus/data/etc/systemd/system/dbus.socket
new file mode 100644
index 00000000..5c373cf4
--- /dev/null
+++ b/remote/modules/dbus/data/etc/systemd/system/dbus.socket
@@ -0,0 +1,5 @@
+[Unit]
+Description=D-Bus System Message Bus Socket
+
+[Socket]
+ListenStream=/run/dbus/system_bus_socket
diff --git a/remote/modules/dbus/dbus.build b/remote/modules/dbus/dbus.build
index bcab63b0..81c849fb 100644
--- a/remote/modules/dbus/dbus.build
+++ b/remote/modules/dbus/dbus.build
@@ -7,11 +7,26 @@ fetch_source() {
build() {
COPYLIST="list_dpkg_output"
[ -e "${COPYLIST}" ] && rm "${COPYLIST}"
-
- list_packet_files >> "${COPYLIST}"
+
+ list_packet_files >> "${COPYLIST}"
tarcopy "$(cat "${COPYLIST}" | sort -u)" "${MODULE_BUILD_DIR}"
-
+
+ # Generate systemd files
+ mkdir "$MODULE_BUILD_DIR/etc/systemd/system"
+ local UUIDGEN=$(find "$MODULE_BUILD_DIR" -name dbus-uuidgen -executable | head -n 1)
+ local DAEMON=$(find "$MODULE_BUILD_DIR" -name dbus-daemon -executable | head -n 1)
+ local SEND=$(find "$MODULE_BUILD_DIR" -name dbus-send -executable | head -n 1)
+ UUIDGEN="${UUIDGEN#$MODULE_BUILD_DIR}"
+ DAEMON="${DAEMON#$MODULE_BUILD_DIR}"
+ SEND="${SEND#$MODULE_BUILD_DIR}"
+ [ -z "$UUIDGEN" ] && perror "Could not determine dbus-uuidgen location"
+ [ -z "$DAEMON" ] && perror "Could not determine dbus-daemon location"
+ [ -z "$SEND" ] && perror "Could not determine dbus-send location"
+ sed "s,%UUIDGEN%,/$UUIDGEN,g;s,%DAEMON%,$DAEMON,g;s,%SEND%,$SEND,g" "templates/dbus.service" \
+ > "$MODULE_BUILD_DIR/etc/systemd/system/dbus.service" \
+ || perror "Could not generate $MODULE_BUILD_DIR/etc/systemd/system/dbus.service"
}
post_copy() {
:
}
+
diff --git a/remote/modules/dbus/templates/dbus.service b/remote/modules/dbus/templates/dbus.service
new file mode 100644
index 00000000..b6e05271
--- /dev/null
+++ b/remote/modules/dbus/templates/dbus.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=D-Bus System Message Bus
+Requires=dbus.socket
+After=syslog.target
+
+[Service]
+ExecStartPre=%UUIDGEN% --ensure
+ExecStartPre=-/bin/rm -f /run/dbus/pid
+ExecStart=%DAEMON% --system --address=systemd: --nofork --activation=systemd
+ExecReload=%SEND% --print-reply --system --type=method_call --dest=org.freedesktop.DBus / org.freedesktop.DBus.ReloadConfig
+OOMScoreAdjust=-900