From: Simon McVittie Date: Thu, 24 Sep 2015 13:58:02 +0100 Subject: 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 in telepathy-mission-control. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92164 Forwarded: yes Bug-Apertis: https://phabricator.apertis.org/T284 --- src/dbus/server/org.syncevolution.service.in | 1 + src/dbus/server/pim/org._01.pim.contacts.service.in | 1 + src/dbus/server/server.am | 10 ++++++++++ src/dbus/server/syncevo-dbus-server.service.in | 7 +++++++ 4 files changed, 19 insertions(+) create mode 100644 src/dbus/server/syncevo-dbus-server.service.in diff --git a/src/dbus/server/org.syncevolution.service.in b/src/dbus/server/org.syncevolution.service.in index edc6376..7799cb6 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 e892372..86122ad 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 8ecfe64..18c631f 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 0000000..8c22359 --- /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@