summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTadao Tanikawa <tanikawa.tadao@jp.panasonic.com>2015-12-09 13:32:30 +0900
committerGerrit Code Review <gerrit@172.30.200.200>2015-12-09 17:07:20 +0000
commite8ccbb70ae58efb15c8f8b3361f686c96c3b64c1 (patch)
tree914e6f795ff7c8afeb4d1f030aff25dc8c3a229e
parent3f47347984890cc447161229552fe172ec73d27e (diff)
D-Bus User Message Bus (Session Bus) is enabled from systemd
D-Bus user message bus (session bus) is enabled from systemd as system's user service. D-Bus daemon becomes enable when triggered by socket access. Change-Id: I8033dd546209288f45917176a38f79aef78062fa Signed-off-by: Tadao Tanikawa <tanikawa.tadao@jp.panasonic.com>
-rw-r--r--meta-agl/recipes-core/dbus/dbus/dbus.service10
-rw-r--r--meta-agl/recipes-core/dbus/dbus/dbus.socket9
-rw-r--r--meta-agl/recipes-core/dbus/dbus/dbus_env.conf5
-rw-r--r--meta-agl/recipes-core/dbus/dbus_%.bbappend26
4 files changed, 50 insertions, 0 deletions
diff --git a/meta-agl/recipes-core/dbus/dbus/dbus.service b/meta-agl/recipes-core/dbus/dbus/dbus.service
new file mode 100644
index 000000000..dee6ad741
--- /dev/null
+++ b/meta-agl/recipes-core/dbus/dbus/dbus.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=D-Bus User Message Bus
+Documentation=man:dbus-daemon(1)
+Requires=dbus.socket
+
+[Service]
+ExecStart=/usr/bin/dbus-daemon --session --address=systemd: --nofork --nopidfile --systemd-activation
+ExecReload=/usr/bin/dbus-send --print-reply --session --type=method_call --dest=org.freedesktop.DBus / org.freedesktop.DBus.ReloadConfig
+Restart=always
+RestartSec=1
diff --git a/meta-agl/recipes-core/dbus/dbus/dbus.socket b/meta-agl/recipes-core/dbus/dbus/dbus.socket
new file mode 100644
index 000000000..af76b2f12
--- /dev/null
+++ b/meta-agl/recipes-core/dbus/dbus/dbus.socket
@@ -0,0 +1,9 @@
+[Unit]
+Description=D-Bus User Message Bus Socket
+Before=sockets.target
+
+[Socket]
+ListenStream=%t/bus
+
+[Install]
+WantedBy=default.target
diff --git a/meta-agl/recipes-core/dbus/dbus/dbus_env.conf b/meta-agl/recipes-core/dbus/dbus/dbus_env.conf
new file mode 100644
index 000000000..f8f02669b
--- /dev/null
+++ b/meta-agl/recipes-core/dbus/dbus/dbus_env.conf
@@ -0,0 +1,5 @@
+[Unit]
+Wants=dbus.service
+
+[Service]
+Environment=DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%I/bus
diff --git a/meta-agl/recipes-core/dbus/dbus_%.bbappend b/meta-agl/recipes-core/dbus/dbus_%.bbappend
new file mode 100644
index 000000000..348be60c1
--- /dev/null
+++ b/meta-agl/recipes-core/dbus/dbus_%.bbappend
@@ -0,0 +1,26 @@
+FILESEXTRAPATHS_append := ":${THISDIR}/${PN}"
+
+SRC_URI_append = "file://dbus.service \
+ file://dbus.socket \
+ file://dbus_env.conf \
+ "
+
+inherit systemd
+
+do_install_append() {
+ if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
+ install -p -D ${WORKDIR}/dbus.service ${D}${systemd_user_unitdir}/dbus.service
+ install -p -D ${WORKDIR}/dbus.socket ${D}${systemd_user_unitdir}/dbus.socket
+ install -p -D ${WORKDIR}/dbus_env.conf ${D}${systemd_system_unitdir}/user@.service.d/dbus_env.conf
+
+ # Execute these manually on behalf of systemctl script (from systemd-systemctl-native.bb)
+ # because it does not support systemd's user mode.
+ mkdir -p ${D}/etc/systemd/user/default.target.wants/
+ ln -sf ${systemd_user_unitdir}/dbus.socket ${D}/etc/systemd/user/default.target.wants/dbus.socket
+ fi
+}
+
+FILES_${PN} += " \
+ ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_user_unitdir}/dbus.*', '', d)} \
+ ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_system_unitdir}/user@.service.d/dbus_env.conf', '', d)} \
+ "