summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2016-09-05 10:53:09 (GMT)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2016-09-06 13:44:29 (GMT)
commit275007184d8e23002ebdd2310c04b48611301c0e (patch)
tree8b0919f06263ab949e63775f03c726a8ca245a33
parent52f27eae12c4790ec725042cfefb9ab1c3c3c70b (diff)
downloadtraprain-275007184d8e23002ebdd2310c04b48611301c0e.tar.gz
traprain-275007184d8e23002ebdd2310c04b48611301c0e.tar.xz
mock-service: add systemd service file
Signed-off-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> Reviewed-by: Mathieu Duponchelle <mathieu.duponchelle@collabora.co.uk> Differential Revision: https://phabricator.apertis.org/D4185
-rw-r--r--Makefile.am8
-rw-r--r--configure.ac17
-rw-r--r--mock-service/traprain-mock-service.service.in21
3 files changed, 46 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am
index 9e05874..cc6fefc 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -421,9 +421,11 @@ mock_service_traprain_mock_service_LDFLAGS = \
$(AM_LDFLAGS) \
$(NULL)
+# systemd and D-Bus service files.
mock-service/%.service: mock-service/%.service.in Makefile
$(AM_V_GEN) sed \
-e "s|[@]bindir[@]|$(bindir)|" \
+ -e "s|[@]MOCK_USER[@]|$(MOCK_USER)|" \
$< > $@.tmp && mv $@.tmp $@
dbus_servicedir = $(datadir)/dbus-1/services
@@ -432,12 +434,18 @@ dbus_service_DATA = \
mock-service/org.apertis.Traprain1.Mock.service \
$(NULL)
+systemdsysusers_DATA = \
+ mock-service/traprain-mock-service.service \
+ $(NULL)
+
EXTRA_DIST += \
$(dbus_service_DATA:%=%.in) \
+ $(systemdsysusers_DATA:%=%.in) \
$(NULL)
CLEANFILES += \
$(dbus_service_DATA) \
+ $(systemdsysusers_DATA) \
$(NULL)
# Tests
diff --git a/configure.ac b/configure.ac
index c47870e..68519a3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -116,6 +116,23 @@ AM_CONDITIONAL([ENABLE_INSTALLED_TESTS],
[test "$enable_installed_tests" = "yes"])
AC_SUBST([ENABLE_INSTALLED_TESTS],[$enable_installed_tests])
+# Mock service
+
+AC_ARG_WITH([systemdsysusersdir],
+ AS_HELP_STRING([--with-systemdsysusersdir=DIR],
+ [Directory for systemd sysusers files]),
+ [],[with_systemdsysusersdir='${prefix}/lib/sysusers.d'])
+AC_SUBST([systemdsysusersdir],[$with_systemdsysusersdir])
+
+AC_ARG_WITH([mock-user],
+ [AS_HELP_STRING([--with-mock-user=<user>],
+ [User for running the mock Traprain service (default: traprain-mock)])],
+ [],[with_mock_user=traprain-mock])
+
+AC_SUBST([MOCK_USER],[$with_mock_user])
+AC_DEFINE_UNQUOTED([MOCK_USER],"$with_mock_user",
+ [User for running the Traprain mock service])
+
AC_CONFIG_FILES([
Makefile
traprain-common/libtraprain-common-$TRP_API_VERSION.pc:traprain-common/libtraprain-common.pc.in
diff --git a/mock-service/traprain-mock-service.service.in b/mock-service/traprain-mock-service.service.in
new file mode 100644
index 0000000..52cf5ca
--- /dev/null
+++ b/mock-service/traprain-mock-service.service.in
@@ -0,0 +1,21 @@
+[Unit]
+Description=Navigation Service (Mock)
+Before=systemd-user-sessions.service
+
+[Service]
+ExecStart=@bindir@/traprain-mock-service
+Type=dbus
+BusName=org.apertis.Traprain1.Mock
+NotifyAccess=main
+User=@MOCK_USER@
+Environment=GIO_USE_VFS=local
+CapabilityBoundingSet=
+PrivateNetwork=no
+PrivateDevices=no
+ProtectSystem=full
+ProtectHome=yes
+PrivateTmp=yes
+NoNewPrivileges=yes
+
+[Install]
+WantedBy=multi-user.target