aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2018-12-12 19:53:27 +0100
committerPau Espin Pedrol <pespin@sysmocom.de>2018-12-12 19:53:27 +0100
commitae6ca315165fd9fb785c3bd70337b97401ea0c15 (patch)
treecac09c114671f30bb90283ec872e574be8ceec59
parentae25399f759d69f78433297526505f5e98a55803 (diff)
Install systemd services with autotoolspespin/master
-rw-r--r--Makefile.am5
-rw-r--r--configure.ac19
-rw-r--r--contrib/Makefile.am1
-rw-r--r--contrib/systemd/Makefile.am6
-rw-r--r--contrib/systemd/osmo-sysmon.service11
5 files changed, 41 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am
index a838715..6018753 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,3 +1,6 @@
-SUBDIRS = doc src
+SUBDIRS = contrib doc src
ACLOCAL_AMFLAGS = -I m4
+
+AM_DISTCHECK_CONFIGURE_FLAGS = \
+ --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir)
diff --git a/configure.ac b/configure.ac
index 734ac99..ba44f98 100644
--- a/configure.ac
+++ b/configure.ac
@@ -120,6 +120,23 @@ then
CPPFLAGS="$CPPFLAGS -pg"
fi
+# https://www.freedesktop.org/software/systemd/man/daemon.html
+PKG_PROG_PKG_CONFIG
+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"])
@@ -127,6 +144,8 @@ dnl Generate the output
AM_CONFIG_HEADER(config.h)
AC_OUTPUT(
+ contrib/Makefile
+ contrib/systemd/Makefile
doc/Makefile
doc/examples/Makefile
src/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..10b28d9
--- /dev/null
+++ b/contrib/systemd/Makefile.am
@@ -0,0 +1,6 @@
+EXTRA_DIST = osmo-sysmon.service
+
+if HAVE_SYSTEMD
+systemdsystemunit_DATA = \
+ osmo-sysmon.service
+endif
diff --git a/contrib/systemd/osmo-sysmon.service b/contrib/systemd/osmo-sysmon.service
new file mode 100644
index 0000000..50d6639
--- /dev/null
+++ b/contrib/systemd/osmo-sysmon.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=Osmocom System Monitoring daemon
+
+[Service]
+Type=simple
+Restart=always
+ExecStart=/usr/bin/osmo-sysmon -c /etc/osmocom/osmo-sysmon.cfg
+RestartSec=2
+
+[Install]
+WantedBy=multi-user.target