3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-23 22:42:37 +01:00

build: Add support for installing systemd service unit

This commit is contained in:
Marcel Holtmann 2018-02-10 18:42:43 +01:00
parent 90aafba6d4
commit c31244ddec
4 changed files with 50 additions and 3 deletions

1
.gitignore vendored
View File

@ -19,6 +19,7 @@ build-aux
autom4te.cache
ell
src/iwd
src/iwd.service
client/iwctl
monitor/iwmon
tools/hwsim

View File

@ -64,7 +64,9 @@ ell_sources = ell/ell.h ell/private.h ell/missing.h \
ell_libell_internal_la_SOURCES = $(ell_sources)
bin_PROGRAMS = src/iwd
bin_PROGRAMS =
libexec_PROGRAMS = src/iwd
src_iwd_SOURCES = src/main.c linux/nl80211.h \
src/netdev.h src/netdev.c \
@ -104,6 +106,13 @@ src_iwd_SOURCES = src/main.c linux/nl80211.h \
src_iwd_LDADD = ell/libell-internal.la -ldl
if SYSTEMD_SERVICE
src_iwd_DEPENDENCIES = src/iwd.service
systemd_unitdir = @SYSTEMD_UNITDIR@
systemd_unit_DATA = src/iwd.service
endif
if CLIENT
bin_PROGRAMS += client/iwctl
@ -275,11 +284,14 @@ if BUILD_DOCS
dist_man_MANS = $(manual_pages)
endif
EXTRA_DIST = src/genbuiltin doc/main.conf $(manual_pages:.1=.txt)
EXTRA_DIST = src/genbuiltin src/iwd.service.in \
doc/main.conf $(manual_pages:.1=.txt)
AM_CFLAGS = -fvisibility=hidden
DISTCHECK_CONFIGURE_FLAGS = --disable-dbus-policy
CLEANFILES = src/iwd.service
DISTCHECK_CONFIGURE_FLAGS = --disable-dbus-policy --disable-systemd-service
DISTCLEANFILES = $(BUILT_SOURCES) $(unit_tests) $(manual_pages)
@ -309,6 +321,13 @@ ell/unit/test_data: Makefile
fi \
done > $@
SED_PROCESS = $(AM_V_GEN)$(MKDIR_P) $(dir $@) && \
$(SED) -e 's,@libexecdir\@,$(libexecdir),g' \
< $< > $@
%.service: %.service.in Makefile
$(SED_PROCESS)
%.1: %.txt
$(AM_V_GEN)$(A2X) --doctype manpage --format manpage $(srcdir)/$<

View File

@ -122,6 +122,24 @@ if (test "${enable_dbus_policy}" != "no" && test -z "${path_dbus_datadir}"); the
fi
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],
[build documentation and manual pages]),
[enable_docs=${enableval}])

9
src/iwd.service.in Normal file
View File

@ -0,0 +1,9 @@
[Unit]
Description=Wireless service
[Service]
ExecStart=@libexecdir@/iwd
LimitNPROC=1
[Install]
WantedBy=network-pre.target