Install systemd services with autotools

Change-Id: I7e4dae6b8c1685e8a673c58a843c41fa0af1b35c
This commit is contained in:
Pau Espin 2018-09-10 12:46:47 +02:00
parent 4ca0b0d1fa
commit e686675f7d
7 changed files with 32 additions and 2 deletions

View File

@ -24,6 +24,9 @@ pkgconfig_DATA = \
BUILT_SOURCES = $(top_srcdir)/.version
EXTRA_DIST = git-version-gen osmoappdesc.py .version
DISTCHECK_CONFIGURE_FLAGS = \
--with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir)
@RELMAKE@
$(top_srcdir)/.version:

View File

@ -128,6 +128,22 @@ AC_MSG_CHECKING([whether to enable VTY/CTRL tests])
AC_MSG_RESULT([$enable_ext_tests])
AM_CONDITIONAL(ENABLE_EXT_TESTS, test "x$enable_ext_tests" = "xyes")
# https://www.freedesktop.org/software/systemd/man/daemon.html
AC_ARG_WITH([systemdsystemunitdir],
[AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],,
[with_systemdsystemunitdir=auto])
AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"], [
def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
AS_IF([test "x$def_systemdsystemunitdir" = "x"],
[AS_IF([test "x$with_systemdsystemunitdir" = "xyes"],
[AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])])
with_systemdsystemunitdir=no],
[with_systemdsystemunitdir="$def_systemdsystemunitdir"])])
AS_IF([test "x$with_systemdsystemunitdir" != "xno"],
[AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])])
AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"])
AC_MSG_RESULT([CFLAGS="$CFLAGS"])
AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"])
@ -151,4 +167,5 @@ AC_OUTPUT(
doc/Makefile
doc/examples/Makefile
contrib/Makefile
contrib/systemd/Makefile
Makefile)

View File

@ -1 +1,3 @@
SUBDIRS = systemd
EXTRA_DIST = ipa.py

View File

@ -0,0 +1,5 @@
if HAVE_SYSTEMD
EXTRA_DIST = osmo-mgw.service
systemdsystemunit_DATA = \
osmo-mgw.service
endif

View File

@ -1,2 +1,3 @@
lib/systemd/system/osmo-mgw.service
usr/bin/osmo-mgw
usr/share/doc/osmo-mgw/examples/osmo-mgw/osmo-mgw.cfg

View File

@ -1 +0,0 @@
../contrib/systemd/osmo-mgw.service

5
debian/rules vendored
View File

@ -14,7 +14,7 @@ CFLAGS += -g
# main packaging script based on dh7 syntax
%:
dh $@ --with autoreconf
dh $@ --with autoreconf
# debmake generated override targets
# Set options for ./configure
@ -29,4 +29,7 @@ CFLAGS += -g
override_dh_auto_test:
dh_auto_test || (find . -name testsuite.log -exec cat {} \; ; false)
override_dh_auto_configure:
dh_auto_configure -- --with-systemdsystemunitdir=/lib/systemd/system
# See https://www.debian.org/doc/manuals/developers-reference/best-pkging-practices.html#bpp-dbg