aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2018-09-10 12:40:56 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2018-09-13 11:52:30 +0200
commit97ba4062f892f349bc9695420bcd3e269b5747a7 (patch)
treecda3497a7ecf7dbf730a3821820d5e6fca87eac0
parente17ae024fa404c24ecd9c33c9397bd9ce98d6f95 (diff)
Install systemd services with autotools
-rw-r--r--Makefile.am4
-rw-r--r--configure.ac18
-rw-r--r--contrib/Makefile.am1
-rw-r--r--contrib/systemd/Makefile.am9
-rw-r--r--debian/control1
-rw-r--r--debian/osmo-gbproxy.install1
l---------debian/osmo-gbproxy.service1
-rw-r--r--debian/osmo-gtphub.install1
l---------debian/osmo-gtphub.service1
-rw-r--r--debian/osmo-sgsn.install1
l---------debian/osmo-sgsn.service1
-rwxr-xr-xdebian/rules2
12 files changed, 37 insertions, 4 deletions
diff --git a/Makefile.am b/Makefile.am
index 38fdcba..1883ab5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -12,6 +12,7 @@ SUBDIRS = \
doc \
include \
src \
+ contrib \
tests \
$(NULL)
@@ -21,6 +22,9 @@ pkgconfig_DATA = osmo-sgsn.pc
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:
diff --git a/configure.ac b/configure.ac
index c233fa3..73b6dce 100644
--- a/configure.ac
+++ b/configure.ac
@@ -176,6 +176,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"])
@@ -201,4 +217,6 @@ AC_OUTPUT(
tests/v42bis/Makefile
doc/Makefile
doc/examples/Makefile
+ contrib/Makefile
+ contrib/systemd/Makefile
Makefile)
diff --git a/contrib/Makefile.am b/contrib/Makefile.am
new file mode 100644
index 0000000..3439c97
--- /dev/null
+++ b/contrib/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = systemd
diff --git a/contrib/systemd/Makefile.am b/contrib/systemd/Makefile.am
new file mode 100644
index 0000000..b644f34
--- /dev/null
+++ b/contrib/systemd/Makefile.am
@@ -0,0 +1,9 @@
+if HAVE_SYSTEMD
+SYSTEMD_SERVICES = \
+ osmo-gbproxy.service \
+ osmo-gtphub.service \
+ osmo-sgsn.service
+
+EXTRA_DIST = $(SYSTEMD_SERVICES)
+systemdsystemunit_DATA = $(SYSTEMD_SERVICES)
+endif
diff --git a/debian/control b/debian/control
index 330945f..46a6b67 100644
--- a/debian/control
+++ b/debian/control
@@ -4,6 +4,7 @@ Priority: extra
Maintainer: Alexander Couzens <lynxis@fe80.eu>
Build-Depends: debhelper (>=9),
dh-autoreconf,
+ dh-systemd (>= 1.5),
autotools-dev,
autoconf,
automake,
diff --git a/debian/osmo-gbproxy.install b/debian/osmo-gbproxy.install
index 8272551..9c7fb77 100644
--- a/debian/osmo-gbproxy.install
+++ b/debian/osmo-gbproxy.install
@@ -1,3 +1,4 @@
+lib/systemd/system/osmo-gbproxy.service
usr/bin/osmo-gbproxy
usr/share/doc/osmo-sgsn/examples/osmo-gbproxy/osmo-gbproxy-legacy.cfg usr/share/doc/osmo-gbproxy/examples
usr/share/doc/osmo-sgsn/examples/osmo-gbproxy/osmo-gbproxy.cfg usr/share/doc/osmo-gbproxy/examples
diff --git a/debian/osmo-gbproxy.service b/debian/osmo-gbproxy.service
deleted file mode 120000
index d23c649..0000000
--- a/debian/osmo-gbproxy.service
+++ /dev/null
@@ -1 +0,0 @@
-../contrib/systemd/osmo-gbproxy.service \ No newline at end of file
diff --git a/debian/osmo-gtphub.install b/debian/osmo-gtphub.install
index ed0bd1b..568caaf 100644
--- a/debian/osmo-gtphub.install
+++ b/debian/osmo-gtphub.install
@@ -1,3 +1,4 @@
+lib/systemd/system/osmo-gtphub.service
usr/bin/osmo-gtphub
usr/share/doc/osmo-sgsn/examples/osmo-gtphub/osmo-gtphub-1iface.cfg usr/share/doc/osmo-gtphub/examples
usr/share/doc/osmo-sgsn/examples/osmo-gtphub/osmo-gtphub.cfg usr/share/doc/osmo-gtphub/examples
diff --git a/debian/osmo-gtphub.service b/debian/osmo-gtphub.service
deleted file mode 120000
index 81a0eb4..0000000
--- a/debian/osmo-gtphub.service
+++ /dev/null
@@ -1 +0,0 @@
-../contrib/systemd/osmo-gtphub.service \ No newline at end of file
diff --git a/debian/osmo-sgsn.install b/debian/osmo-sgsn.install
index 9390deb..9d603f9 100644
--- a/debian/osmo-sgsn.install
+++ b/debian/osmo-sgsn.install
@@ -1,3 +1,4 @@
+lib/systemd/system/osmo-sgsn.service
usr/bin/osmo-sgsn
usr/share/doc/osmo-sgsn/examples/osmo-sgsn/osmo-sgsn.cfg usr/share/doc/osmo-sgsn/examples
usr/share/doc/osmo-sgsn/examples/osmo-sgsn/osmo-sgsn-accept-all.cfg usr/share/doc/osmo-sgsn/examples
diff --git a/debian/osmo-sgsn.service b/debian/osmo-sgsn.service
deleted file mode 120000
index de22d90..0000000
--- a/debian/osmo-sgsn.service
+++ /dev/null
@@ -1 +0,0 @@
-../contrib/systemd/osmo-sgsn.service \ No newline at end of file
diff --git a/debian/rules b/debian/rules
index fb31c58..af6b5b6 100755
--- a/debian/rules
+++ b/debian/rules
@@ -46,7 +46,7 @@
# debmake generated override targets
# Set options for ./configure
-CONFIGURE_FLAGS += --enable-iu
+CONFIGURE_FLAGS += --enable-iu --with-systemdsystemunitdir=/lib/systemd/system
override_dh_auto_configure:
dh_auto_configure -- $(CONFIGURE_FLAGS)
#