summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2015-09-24 13:58:02 +0100
committerPatrick Ohly <patrick.ohly@intel.com>2016-09-26 12:58:27 +0200
commit9103a70c72d7f4aed0959963fc18b0f597af6572 (patch)
treefbc1b6264e59a2c9a0e871949bf86655f4088940
parente126bd500e0fd3eba4a29c1ffaa37a78d910f02b (diff)
Add a systemd user service as a backend for the D-Bus session services
On systems with a systemd user session and a D-Bus user bus that uses it for activation, this ensures that syncevo-dbus-server ends up in its own cgroup, instead of being treated as part of dbus.service. If org._01.pim.contacts and org.syncevolution are activated in quick succession, it also prevents a race condition that would make one of the activations fail, similar to <https://bugs.freedesktop.org/show_bug.cgi?id=53220> in telepathy-mission-control.
-rw-r--r--src/dbus/server/org.syncevolution.service.in1
-rw-r--r--src/dbus/server/pim/org._01.pim.contacts.service.in1
-rw-r--r--src/dbus/server/server.am10
-rw-r--r--src/dbus/server/syncevo-dbus-server.service.in7
4 files changed, 19 insertions, 0 deletions
diff --git a/src/dbus/server/org.syncevolution.service.in b/src/dbus/server/org.syncevolution.service.in
index edc63764..7799cb68 100644
--- a/src/dbus/server/org.syncevolution.service.in
+++ b/src/dbus/server/org.syncevolution.service.in
@@ -1,3 +1,4 @@
[D-BUS Service]
Name=org.syncevolution
Exec=@libexecdir@/syncevo-dbus-server @SYNCEVO_DBUS_SERVER_ARGS@
+SystemdService=syncevo-dbus-server.service
diff --git a/src/dbus/server/pim/org._01.pim.contacts.service.in b/src/dbus/server/pim/org._01.pim.contacts.service.in
index e892372c..86122adf 100644
--- a/src/dbus/server/pim/org._01.pim.contacts.service.in
+++ b/src/dbus/server/pim/org._01.pim.contacts.service.in
@@ -1,3 +1,4 @@
[D-BUS Service]
Name=org._01.pim.contacts
Exec=@libexecdir@/syncevo-dbus-server @SYNCEVO_DBUS_SERVER_ARGS@
+SystemdService=syncevo-dbus-server.service
diff --git a/src/dbus/server/server.am b/src/dbus/server/server.am
index 8ecfe64d..18c631fe 100644
--- a/src/dbus/server/server.am
+++ b/src/dbus/server/server.am
@@ -117,6 +117,7 @@ src_dbus_server_libsyncevodbushelper_la_CXXFLAGS = $(SYNCEVOLUTION_CXXFLAGS) $(C
# Deal with .service, .desktop and startup script files.
CLEANFILES += \
$(src_dbus_server_service_files) \
+ $(src_dbus_server_systemd_files) \
$(src_dbus_server_desktop) \
$(src_dbus_server_script)
@@ -137,10 +138,18 @@ src_dbus_server_service_files_in = src/dbus/server/org.syncevolution.service.in
src_dbus_server_service_files = $(src_dbus_server_service_files_in:.service.in=.service)
src_dbus_server_servicedir = $(DBUS_SERVICES_DIR)
src_dbus_server_service_DATA = $(src_dbus_server_service_files)
+
+src_dbus_server_systemd_files_in = src/dbus/server/syncevo-dbus-server.service.in
+src_dbus_server_systemd_files = $(src_dbus_server_systemd_files_in:.service.in=.service)
+src_dbus_server_systemddir = $(prefix)/lib/systemd/user
+src_dbus_server_systemd_DATA = $(src_dbus_server_systemd_files)
+
+# this works for both dbus and systemd service files
src/dbus/server/%.service: src/dbus/server/%.service.in
@sed -e "s|\@libexecdir\@|$(libexecdir)|" -e "s|\@SYNCEVO_DBUS_SERVER_ARGS\@|$(SYNCEVO_DBUS_SERVER_ARGS)|" $< >$@
if COND_DBUS_PIM
+# this shares syncevo-dbus-server.service
src_dbus_server_service_files_in += \
src/dbus/server/pim/org._01.pim.contacts.service.in
@@ -175,6 +184,7 @@ endif # COND_DBUS_PIM
dist_noinst_DATA += \
$(src_dbus_server_service_files_in) \
+ $(src_dbus_server_systemd_files_in) \
$(src_dbus_server_script_in) \
$(src_dbus_server_desktop_in)
diff --git a/src/dbus/server/syncevo-dbus-server.service.in b/src/dbus/server/syncevo-dbus-server.service.in
new file mode 100644
index 00000000..8c223595
--- /dev/null
+++ b/src/dbus/server/syncevo-dbus-server.service.in
@@ -0,0 +1,7 @@
+[Unit]
+Description=personal information management synchronization service
+
+[Service]
+Type=dbus
+BusName=org.syncevolution
+ExecStart=@libexecdir@/syncevo-dbus-server @SYNCEVO_DBUS_SERVER_ARGS@