summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2010-10-02 20:20:31 +0200
committerMarcel Holtmann <marcel@holtmann.org>2010-10-02 20:20:31 +0200
commit17f7fffa2a0b5b3d3f92a7cd69c59713ad2d2544 (patch)
treecd8196f9fbdce7318d25f90a2eea8ac2df98baf9
parent1e58136e2653c4a28a9fc78f51e165611cee8f89 (diff)
downloadofono-17f7fffa2a0b5b3d3f92a7cd69c59713ad2d2544.tar.bz2
build: Add support for systemd configuration
-rw-r--r--Makefile.am6
-rw-r--r--configure.ac13
-rw-r--r--src/ofono.service.in15
3 files changed, 28 insertions, 6 deletions
diff --git a/Makefile.am b/Makefile.am
index ffebcfdd..7c84a90f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -26,9 +26,11 @@ dbusconfdir = @DBUS_CONFDIR@
dbusconf_DATA = src/ofono.conf
-dbusdatadir = @DBUS_DATADIR@
+if SYSTEMD
+systemdunitdir = @SYSTEMD_UNITDIR@
-dbusdata_DATA = src/ofono.service
+systemdunit_DATA = src/ofono.service
+endif
confdir = $(sysconfdir)/ofono
diff --git a/configure.ac b/configure.ac
index 58f4b08d..eff967e1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -112,6 +112,19 @@ else
fi
AC_SUBST(DBUS_DATADIR)
+AC_ARG_ENABLE(systemd, AC_HELP_STRING([--enable-systemd],
+ [enable systemd support]), [enable_systemd=${enableval}])
+if (test "${enable_systemd}" = "yes"); then
+ PKG_CHECK_MODULES(SYSTEMD, systemd, dummy=yes,
+ AC_MSG_ERROR(systemd is required))
+ SYSTEMD_UNITDIR="`$PKG_CONFIG --variable=systemdsystemunitdir systemd`"
+ if (test -z "${SYSTEM_UNITDIR}"); then
+ SYSTEMD_UNITDIR="/lib/systemd/system"
+ fi
+ AC_SUBST(SYSTEMD_UNITDIR)
+fi
+AM_CONDITIONAL(SYSTEMD, test "${enable_systemd}" = "yes")
+
AC_ARG_ENABLE(capng, AC_HELP_STRING([--enable-capng],
[enable capabilities support]), [enable_capng=${enableval}])
if (test "${enable_capng}" = "yes"); then
diff --git a/src/ofono.service.in b/src/ofono.service.in
index 2eecbf93..f4531a8d 100644
--- a/src/ofono.service.in
+++ b/src/ofono.service.in
@@ -1,4 +1,11 @@
-[D-BUS Service]
-Name=org.ofono
-Exec=@prefix@/sbin/ofonod
-User=root
+[Unit]
+Description=Telephony service
+After=syslog.target
+
+[Service]
+Type=dbus
+BusName=org.ofono
+ExecStart=@prefix@/sbin/ofonod -n
+
+[Install]
+WantedBy=multi-user.target