Commit af35cfe5 authored by Colin Guthrie's avatar Colin Guthrie Committed by Zeeshan Ali

Add support for bus-activation via systemd service unit

On systemd systems it is preferred to use systemd to launch services in
order to properly track processes and allocate system resources. When
dbus launches binary daemons internally they will stay in the dbus
cgroup and thus proper resource allocation and process tracking is not
possible.

https://bugs.freedesktop.org/show_bug.cgi?id=72925
parent 12804f7e
......@@ -167,6 +167,16 @@ else
ifelse([$1],,[:],[$1])
fi
# systemd
AC_ARG_WITH([systemdsystemunitdir],
AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
[],
[with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
if test "x$with_systemdsystemunitdir" != "xno"; then
AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
fi
AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$systemdsystemunitdir"])
AC_CONFIG_FILES([
Makefile
src/Makefile
......@@ -191,4 +201,5 @@ AC_MSG_NOTICE([
prefix: ${prefix}
c compiler: ${CC} ${CFLAGS}
systemdsystemunitdir: ${systemdsystemunitdir}
])
......@@ -11,8 +11,20 @@ dbusservicedir = $(DBUS_SYS_DIR)
dbusservice_DATA = org.freedesktop.GeoClue2.conf \
org.freedesktop.GeoClue2.Agent.conf
systemdservice_in_files = geoclue.service.in
if HAVE_SYSTEMD
systemdservicedir = $(systemdsystemunitdir)
systemdservice_DATA = $(systemdservice_in_files:.service.in=.service)
$(systemdservice_DATA): $(systemdservice_in_files) Makefile
@sed -e "s|\@libexecdir\@|$(libexecdir)|" $< | \
sed -e "s|\@dbus_srv_user\@|$(dbus_srv_user)|" > $@
endif
DISTCLEANFILES = $(service_DATA)
EXTRA_DIST = $(service_in_files) \
$(systemdservice_in_files) \
$(dbusservice_DATA)
-include $(top_srcdir)/git.mk
[Unit]
Description=Location Lookup Service
[Service]
Type=dbus
BusName=org.freedesktop.GeoClue2
User=@dbus_srv_user@
ExecStart=@libexecdir@/geoclue -t 5
......@@ -2,3 +2,4 @@
Name=org.freedesktop.GeoClue2
Exec=@libexecdir@/geoclue -t 5
User=@dbus_srv_user@
SystemdService=geoclue.service
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment