Rygel becomes systemd user service 11/4411/4
authorTadao Tanikawa <tanikawa.tadao@jp.panasonic.com>
Wed, 9 Dec 2015 04:44:05 +0000 (13:44 +0900)
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>
Fri, 11 Dec 2015 12:29:11 +0000 (12:29 +0000)
Now Rygel becomes systemd user service because
it needs D-Bus session bus provided by D-Bus Daemon which
is managed by systemd (as user service).

Change-Id: Ib763b68b758e4b1fb7efc76f846f5e6d07a67bd9
Signed-off-by: Tadao Tanikawa <tanikawa.tadao@jp.panasonic.com>
meta-agl/recipes-connectivity/rygel/files/rygel.service
meta-agl/recipes-connectivity/rygel/rygel_%.bbappend

index 95c701d..fb94d71 100644 (file)
@@ -4,10 +4,10 @@ After=lightmediascanner.service
 Requires=lightmediascanner.service
 
 [Service]
-Environment=DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%U/dbus/user_bus_socket
-User=root
-ExecStartPre=/bin/sleep 3
-ExecStart=/usr/bin/dbus-launch --auto-syntax /usr/bin/rygel -c /etc/rygel.conf
+Type=dbus
+BusName=org.gnome.Rygel1
+ExecStart=/usr/bin/rygel -c /etc/rygel.conf
 
 [Install]
-WantedBy=multi-user.target
+WantedBy=default.target
+Alias=dbus-org.gnome.Rygel1.service
index 7cfb9c0..3dcb854 100644 (file)
@@ -10,13 +10,19 @@ SRC_URI += "file://0001-Add-LightMediaScanner-plugin.patch \
 
 inherit systemd
 
-SYSTEMD_PACKAGES = "${PN}"
-SYSTEMD_SERVICE_${PN} = ""
-SYSTEMD_SERVICE_${PN} += "rygel.service"
-
 do_install_append() {
        # Install rygel systemd service
        if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
-              install -p -D ${WORKDIR}/rygel.service ${D}${systemd_unitdir}/system/rygel.service
+              install -p -D ${WORKDIR}/rygel.service ${D}${systemd_user_unitdir}/rygel.service
+
+              # 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}/lightmediascanner.service ${D}/etc/systemd/user/dbus-org.gnome.Rygel1.service
+              ln -sf ${systemd_user_unitdir}/lightmediascanner.service ${D}/etc/systemd/user/default.target.wants/rygel.service
        fi
 }
+
+FILES_${PN} += " \
+    ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_user_unitdir}/rygel.service', '', d)} \
+    "