3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-26 02:19:26 +01:00

build: Add support for systemd D-Bus activation

This commit is contained in:
Marcel Holtmann 2018-08-06 22:34:11 +02:00
parent 276a9a1acf
commit 28573c90d1
4 changed files with 43 additions and 19 deletions

View File

@ -122,6 +122,9 @@ src_iwd_DEPENDENCIES += src/iwd.service
systemd_unitdir = @SYSTEMD_UNITDIR@ systemd_unitdir = @SYSTEMD_UNITDIR@
systemd_unit_DATA = src/iwd.service systemd_unit_DATA = src/iwd.service
dbus_busdir = @DBUS_BUSDIR@
dbus_bus_DATA = src/net.connman.iwd.service
endif endif
if CLIENT if CLIENT
@ -314,7 +317,7 @@ if BUILD_DOCS
dist_man_MANS = $(manual_pages) dist_man_MANS = $(manual_pages)
endif endif
EXTRA_DIST = src/genbuiltin src/iwd.service.in \ EXTRA_DIST = src/genbuiltin src/iwd.service.in src/net.connman.iwd.service \
doc/main.conf $(manual_pages:.1=.txt) doc/main.conf $(manual_pages:.1=.txt)
AM_CFLAGS = -fvisibility=hidden AM_CFLAGS = -fvisibility=hidden

View File

@ -104,6 +104,37 @@ AC_ARG_ENABLE([monitor], AC_HELP_STRING([--disable-monitor],
[enable_monitor=${enableval}]) [enable_monitor=${enableval}])
AM_CONDITIONAL(MONITOR, test "${enable_monitor}" != "no") AM_CONDITIONAL(MONITOR, test "${enable_monitor}" != "no")
AC_ARG_ENABLE([systemd-service], AC_HELP_STRING([--disable-systemd-service],
[don't install systemd service file]),
[enable_systemd_service=${enableval}])
AM_CONDITIONAL(SYSTEMD_SERVICE, test "${enable_systemd_service}" != "no")
AC_ARG_WITH([systemd-unitdir], AC_HELP_STRING([--with-systemd-unitdir=DIR],
[path to systemd unit directory]),
[path_systemd_unitdir=${withval}])
if (test "${enable_systemd_service}" != "no" && test -z "${path_systemd_unitdir}"); then
AC_MSG_CHECKING([systemd unit directory])
path_systemd_unitdir="`$PKG_CONFIG --variable=systemdsystemunitdir systemd`"
if (test -z "${path_systemd_unitdir}"); then
AC_MSG_ERROR([systemd unit directory is required])
fi
AC_MSG_RESULT([${path_systemd_unitdir}])
fi
AC_SUBST(SYSTEMD_UNITDIR, [${path_systemd_unitdir}])
AC_ARG_WITH([dbus-busdir], AC_HELP_STRING([--with-dbus-busdir=DIR],
[path to D-Bus bus services directory]),
[path_dbus_busdir=${withval}])
if (test "${enable_systemd_service}" != "no" && test -z "${path_dbus_busdir}"); then
AC_MSG_CHECKING([D-Bus bus services directory])
path_dbus_busdir="`$PKG_CONFIG --variable=system_bus_services_dir dbus-1`"
if (test -z "${path_dbus_busdir}"); then
AC_MSG_ERROR([D-Bus bus services directory is required])
fi
AC_MSG_RESULT([${path_dbus_busdir}])
fi
AC_SUBST(DBUS_BUSDIR, [${path_dbus_busdir}])
AC_ARG_ENABLE([dbus-policy], AC_HELP_STRING([--disable-dbus-policy], AC_ARG_ENABLE([dbus-policy], AC_HELP_STRING([--disable-dbus-policy],
[don't install D-Bus system policy file]), [don't install D-Bus system policy file]),
[enable_dbus_policy=${enableval}]) [enable_dbus_policy=${enableval}])
@ -125,24 +156,6 @@ if (test "${enable_dbus_policy}" != "no" && test -z "${path_dbus_datadir}"); the
fi fi
AC_SUBST(DBUS_DATADIR, [${path_dbus_datadir}]) AC_SUBST(DBUS_DATADIR, [${path_dbus_datadir}])
AC_ARG_ENABLE([systemd-service], AC_HELP_STRING([--disable-systemd-service],
[don't install systemd service file]),
[enable_systemd_service=${enableval}])
AM_CONDITIONAL(SYSTEMD_SERVICE, test "${enable_systemd_service}" != "no")
AC_ARG_WITH([systemd-unitdir], AC_HELP_STRING([--with-systemd-unitdir=DIR],
[path to systemd unit directory]),
[path_systemd_unitdir=${withval}])
if (test "${enable_systemd_service}" != "no" && test -z "${path_systemd_unitdir}"); then
AC_MSG_CHECKING([systemd unit directory])
path_systemd_unitdir="`$PKG_CONFIG --variable=systemdsystemunitdir systemd`"
if (test -z "${path_systemd_unitdir}"); then
AC_MSG_ERROR([systemd unit directory is required])
fi
AC_MSG_RESULT([${path_systemd_unitdir}])
fi
AC_SUBST(SYSTEMD_UNITDIR, [${path_systemd_unitdir}])
AC_ARG_ENABLE([docs], AC_HELP_STRING([--enable-docs], AC_ARG_ENABLE([docs], AC_HELP_STRING([--enable-docs],
[build documentation and manual pages]), [build documentation and manual pages]),
[enable_docs=${enableval}]) [enable_docs=${enableval}])

View File

@ -2,8 +2,11 @@
Description=Wireless service Description=Wireless service
[Service] [Service]
Type=dbus
BusName=net.connman.iwd
ExecStart=@libexecdir@/iwd ExecStart=@libexecdir@/iwd
LimitNPROC=1 LimitNPROC=1
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
Alias=dbus-net.connman.iwd.service

View File

@ -0,0 +1,5 @@
[D-BUS Service]
Name=net.connman.iwd
Exec=/bin/false
User=root
SystemdService=dbus-net.connman.iwd.service