Change in osmo-sysmon[master]: Install systemd services with autotools

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Wed Dec 12 18:53:33 UTC 2018


Pau Espin Pedrol has uploaded this change for review. ( https://gerrit.osmocom.org/12286


Change subject: Install systemd services with autotools
......................................................................

Install systemd services with autotools

Change-Id: Ic4875b74bcf2b6232d915070b77fc202a03ef997
---
M Makefile.am
M configure.ac
A contrib/Makefile.am
A contrib/systemd/Makefile.am
A contrib/systemd/osmo-sysmon.service
5 files changed, 41 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-sysmon refs/changes/86/12286/1

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 @@
 	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 @@
 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

-- 
To view, visit https://gerrit.osmocom.org/12286
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-sysmon
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic4875b74bcf2b6232d915070b77fc202a03ef997
Gerrit-Change-Number: 12286
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181212/a4cfce4a/attachment.htm>


More information about the gerrit-log mailing list