add systemd service/unit

Change-Id: I956cd9e7ff378a6372524175a1c83416be45610b
This commit is contained in:
Harald Welte 2020-06-30 21:50:17 +02:00 committed by laforge
parent d32bd186a3
commit e1145c53e3
6 changed files with 43 additions and 0 deletions

View File

@ -1,6 +1,7 @@
AUTOMAKE_OPTIONS = foreign dist-bzip2
SUBDIRS = \
contrib \
doc \
src \
include \
@ -16,6 +17,10 @@ EXTRA_DIST = \
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libosmo-e1d.pc
AM_DISTCHECK_CONFIGURE_FLAGS = \
--with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir)
@RELMAKE@
BUILT_SOURCES = $(top_srcdir)/.version

View File

@ -72,8 +72,26 @@ then
CPPFLAGS="$CPPFLAGS $WERROR_FLAGS"
fi
# 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_OUTPUT(
Makefile
contrib/Makefile
contrib/systemd/Makefile
doc/Makefile
doc/examples/Makefile
src/Makefile

1
contrib/Makefile.am Normal file
View File

@ -0,0 +1 @@
SUBDIRS = systemd

View File

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

View File

@ -0,0 +1,12 @@
[Unit]
Description=Osmocom E1 Interface Daemon
Wants=osmo-e1d.service
[Service]
Type=simple
Restart=always
ExecStart=/usr/bin/osmo-e1d -c /etc/osmocom/osmo-e1d.cfg
RestartSec=2
[Install]
WantedBy=multi-user.target

View File

@ -1,2 +1,3 @@
/etc/osmocom/osmo-e1d.cfg
lib/systemd/system/osmo-e1d.service
usr/bin/osmo-e1d