summaryrefslogtreecommitdiffstats
path: root/core/modules/dbus
diff options
context:
space:
mode:
authorSebastian2016-04-25 12:01:08 +0200
committerSebastian2016-04-25 12:01:08 +0200
commit5acda3eaeabae9045609539303a8c12c4ce401f1 (patch)
tree7e71975f8570b05aafe2ea6ec0e242a8912387bb /core/modules/dbus
parentinitial commit (diff)
downloadmltk-5acda3eaeabae9045609539303a8c12c4ce401f1.tar.gz
mltk-5acda3eaeabae9045609539303a8c12c4ce401f1.tar.xz
mltk-5acda3eaeabae9045609539303a8c12c4ce401f1.zip
merge with latest dev version
Diffstat (limited to 'core/modules/dbus')
-rw-r--r--core/modules/dbus/data/etc/dbus-1/system.d/99-nsa-prism-module.conf14
-rw-r--r--core/modules/dbus/data/etc/systemd/system/dbus.socket5
l---------core/modules/dbus/data/etc/systemd/system/multi-user.target.wants/dbus.service1
l---------core/modules/dbus/data/etc/systemd/system/sockets.target.wants/dbus.socket1
-rw-r--r--core/modules/dbus/module.build65
-rw-r--r--core/modules/dbus/module.conf16
-rw-r--r--core/modules/dbus/module.conf.centos4
-rw-r--r--core/modules/dbus/module.conf.debian9
-rw-r--r--core/modules/dbus/module.conf.fedora4
-rw-r--r--core/modules/dbus/module.conf.opensuse4
-rw-r--r--core/modules/dbus/module.conf.ubuntu7
-rw-r--r--core/modules/dbus/module.conf.ubuntu.169
-rw-r--r--core/modules/dbus/templates/dbus.service13
13 files changed, 152 insertions, 0 deletions
diff --git a/core/modules/dbus/data/etc/dbus-1/system.d/99-nsa-prism-module.conf b/core/modules/dbus/data/etc/dbus-1/system.d/99-nsa-prism-module.conf
new file mode 100644
index 00000000..b6470bd3
--- /dev/null
+++ b/core/modules/dbus/data/etc/dbus-1/system.d/99-nsa-prism-module.conf
@@ -0,0 +1,14 @@
+<!DOCTYPE busconfig PUBLIC
+ "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+<busconfig>
+ <policy user="root">
+ <allow eavesdrop="true"/>
+ <allow eavesdrop="true"
+ send_type="method_call"
+ send_destination="*"
+ send_path="/org/freedesktop/DBus"
+ send_interface="org.freedesktop.DBus"
+ send_member="AddMatch"/>
+ </policy>
+</busconfig>
diff --git a/core/modules/dbus/data/etc/systemd/system/dbus.socket b/core/modules/dbus/data/etc/systemd/system/dbus.socket
new file mode 100644
index 00000000..5c373cf4
--- /dev/null
+++ b/core/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/core/modules/dbus/data/etc/systemd/system/multi-user.target.wants/dbus.service b/core/modules/dbus/data/etc/systemd/system/multi-user.target.wants/dbus.service
new file mode 120000
index 00000000..224df24b
--- /dev/null
+++ b/core/modules/dbus/data/etc/systemd/system/multi-user.target.wants/dbus.service
@@ -0,0 +1 @@
+../dbus.service \ No newline at end of file
diff --git a/core/modules/dbus/data/etc/systemd/system/sockets.target.wants/dbus.socket b/core/modules/dbus/data/etc/systemd/system/sockets.target.wants/dbus.socket
new file mode 120000
index 00000000..fe02d162
--- /dev/null
+++ b/core/modules/dbus/data/etc/systemd/system/sockets.target.wants/dbus.socket
@@ -0,0 +1 @@
+../dbus.socket \ No newline at end of file
diff --git a/core/modules/dbus/module.build b/core/modules/dbus/module.build
new file mode 100644
index 00000000..c6b05a8a
--- /dev/null
+++ b/core/modules/dbus/module.build
@@ -0,0 +1,65 @@
+#!/bin/bash
+
+fetch_source() {
+ echo "Extracting from running system..."
+}
+
+build() {
+ COPYLIST="list_dpkg_output"
+ [ -e "${COPYLIST}" ] && rm "${COPYLIST}"
+
+ list_packet_files >> "${COPYLIST}"
+ tarcopy "$(cat "${COPYLIST}" | sort -u)" "${MODULE_BUILD_DIR}"
+
+ # Generate systemd files
+ mkdir -p "$MODULE_BUILD_DIR/etc/systemd/system"
+ # This is ugly, as the command line arguments changed over time. Try to do the right thing (whatever that is)
+ # Need to run dbus-uuidgen first?
+ local UUIDGEN="# This line intentionally left blank"
+ if files_contain "ExecStartPre.*uuidgen" "/lib/systemd/system/dbus.service" "/usr/lib/systemd/system/dbus.service"; then
+ UUIDGEN=$(find "$MODULE_BUILD_DIR" -name dbus-uuidgen -executable | head -n 1)
+ [ -z "$UUIDGEN" ] && perror "Could not determine dbus-uuidgen location"
+ UUIDGEN="ExecStartPre=/${UUIDGEN#$MODULE_BUILD_DIR} --ensure"
+ fi
+ # Figure out daemon location
+ local DAEMON=$(find "$MODULE_BUILD_DIR" -name dbus-daemon -executable | head -n 1)
+ [ -z "$DAEMON" ] && perror "Could not determine dbus-daemon location"
+ DAEMON="/${DAEMON#$MODULE_BUILD_DIR}"
+ local DAEMON_ARGS=""
+ # Daemon arguments
+ if files_contain "dbus-daemon.*nopidfile" "/lib/systemd/system/dbus.service" "/usr/lib/systemd/system/dbus.service"; then
+ DAEMON_ARGS+=" --nopidfile"
+ fi
+ if files_contain "dbus-daemon.*activation=systemd" "/lib/systemd/system/dbus.service" "/usr/lib/systemd/system/dbus.service"; then
+ DAEMON_ARGS+=" --activation=systemd"
+ fi
+ if files_contain "dbus-daemon.*systemd-activation" "/lib/systemd/system/dbus.service" "/usr/lib/systemd/system/dbus.service"; then
+ DAEMON_ARGS+=" --systemd-activation"
+ fi
+ # dbus-send location
+ local SEND=$(find "$MODULE_BUILD_DIR" -name dbus-send -executable | head -n 1)
+ [ -z "$SEND" ] && perror "Could not determine dbus-send location"
+ SEND="/${SEND#$MODULE_BUILD_DIR}"
+ sed "s,%UUIDGEN%,$UUIDGEN,g;s,%DAEMON%,$DAEMON,g;s,%SEND%,$SEND,g;s,%DAEMON_ARGS%,$DAEMON_ARGS,g" "${MODULE_DIR}/templates/dbus.service" \
+ > "$MODULE_BUILD_DIR/etc/systemd/system/dbus.service" \
+ || perror "Could not generate $MODULE_BUILD_DIR/etc/systemd/system/dbus.service"
+ # This is REQUIRED, otherwise the session daemon won't start (can be empty, but has to exist...)
+ mkdir -p "${MODULE_BUILD_DIR}/etc/dbus-1/session.d"
+}
+
+post_copy() {
+ :
+}
+
+files_contain () {
+ [ $# -lt 2 ] && perror "files_contain needs at least 2 arguments (pattern, file)"
+ local PATTERN="$1"
+ shift
+ local FILE
+ for FILE in $@; do
+ [ -e "$FILE" ] || continue
+ grep -q "$PATTERN" "$FILE" && return 0 # Found
+ done
+ return 1
+}
+
diff --git a/core/modules/dbus/module.conf b/core/modules/dbus/module.conf
new file mode 100644
index 00000000..5e5dc4f8
--- /dev/null
+++ b/core/modules/dbus/module.conf
@@ -0,0 +1,16 @@
+REQUIRED_BINARIES="
+ dbus-cleanup-sockets
+ dbus-daemon
+ dbus-uuidgen
+ dbus-monitor
+ dbus-send
+ dbus-daemon-launch-helper
+ dbus-launch
+ "
+REQUIRED_DIRECTORIES="
+ /etc/dbus-1
+"
+REQUIRED_FILES="
+ /etc/systemd/system/dbus.service
+"
+
diff --git a/core/modules/dbus/module.conf.centos b/core/modules/dbus/module.conf.centos
new file mode 100644
index 00000000..f38f590f
--- /dev/null
+++ b/core/modules/dbus/module.conf.centos
@@ -0,0 +1,4 @@
+REQUIRED_CONTENT_PACKAGES="
+ dbus
+"
+
diff --git a/core/modules/dbus/module.conf.debian b/core/modules/dbus/module.conf.debian
new file mode 100644
index 00000000..d007c2ef
--- /dev/null
+++ b/core/modules/dbus/module.conf.debian
@@ -0,0 +1,9 @@
+REQUIRED_CONTENT_PACKAGES="
+ dbus
+"
+REQUIRED_DIRECTORIES+="
+ /lib/systemd
+"
+REQUIRED_FILES="
+ /etc/default/dbus
+"
diff --git a/core/modules/dbus/module.conf.fedora b/core/modules/dbus/module.conf.fedora
new file mode 100644
index 00000000..f38f590f
--- /dev/null
+++ b/core/modules/dbus/module.conf.fedora
@@ -0,0 +1,4 @@
+REQUIRED_CONTENT_PACKAGES="
+ dbus
+"
+
diff --git a/core/modules/dbus/module.conf.opensuse b/core/modules/dbus/module.conf.opensuse
new file mode 100644
index 00000000..9bc514e2
--- /dev/null
+++ b/core/modules/dbus/module.conf.opensuse
@@ -0,0 +1,4 @@
+REQUIRED_CONTENT_PACKAGES="
+ dbus-1
+"
+
diff --git a/core/modules/dbus/module.conf.ubuntu b/core/modules/dbus/module.conf.ubuntu
new file mode 100644
index 00000000..558eea7f
--- /dev/null
+++ b/core/modules/dbus/module.conf.ubuntu
@@ -0,0 +1,7 @@
+REQUIRED_CONTENT_PACKAGES="
+ dbus
+"
+REQUIRED_FILES+="
+ /etc/default/dbus
+"
+
diff --git a/core/modules/dbus/module.conf.ubuntu.16 b/core/modules/dbus/module.conf.ubuntu.16
new file mode 100644
index 00000000..dc01164f
--- /dev/null
+++ b/core/modules/dbus/module.conf.ubuntu.16
@@ -0,0 +1,9 @@
+REQUIRED_CONTENT_PACKAGES="
+ dbus
+ dbus-x11
+"
+REQUIRED_FILES+="
+"
+REQUIRED_DIRECTORIES="
+ /usr/share/dbus-1
+"
diff --git a/core/modules/dbus/templates/dbus.service b/core/modules/dbus/templates/dbus.service
new file mode 100644
index 00000000..c9f747b0
--- /dev/null
+++ b/core/modules/dbus/templates/dbus.service
@@ -0,0 +1,13 @@
+[Unit]
+Description=D-Bus System Message Bus
+Wants=dbus.socket
+Requires=dbus.socket
+After=syslog.target
+
+[Service]
+%UUIDGEN%
+ExecStartPre=-/opt/openslx/bin/rm -f /var/run/dbus/pid
+ExecStart=%DAEMON% --system --address=systemd: --nofork %DAEMON_ARGS%
+ExecReload=%SEND% --print-reply --system --type=method_call --dest=org.freedesktop.DBus / org.freedesktop.DBus.ReloadConfig
+OOMScoreAdjust=-900
+