mirror of https://gerrit.osmocom.org/osmo-pcap
Install systemd services with autotools
Change-Id: Id938f3dab4826ac748abb5e0b169d800c2a625a5
This commit is contained in:
parent
b96c957a22
commit
b29f84ff6c
|
@ -5,6 +5,10 @@ SUBDIRS = include src contrib tests
|
|||
BUILT_SOURCES = $(top_srcdir)/.version
|
||||
EXTRA_DIST = git-version-gen .version
|
||||
|
||||
DISTCHECK_CONFIGURE_FLAGS = \
|
||||
--with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir)
|
||||
|
||||
|
||||
@RELMAKE@
|
||||
|
||||
$(top_srcdir)/.version:
|
||||
|
|
23
configure.ac
23
configure.ac
|
@ -19,6 +19,13 @@ AC_PROG_CC
|
|||
AC_PROG_INSTALL
|
||||
AC_PROG_RANLIB
|
||||
|
||||
dnl check for pkg-config (explained in detail in libosmocore/configure.ac)
|
||||
AC_PATH_PROG(PKG_CONFIG_INSTALLED, pkg-config, no)
|
||||
if test "x$PKG_CONFIG_INSTALLED" = "xno"; then
|
||||
AC_MSG_WARN([You need to install pkg-config])
|
||||
fi
|
||||
PKG_PROG_PKG_CONFIG([0.20])
|
||||
|
||||
dnl checks for header files
|
||||
AC_HEADER_STDC
|
||||
|
||||
|
@ -52,6 +59,21 @@ 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_ARG_ENABLE([external_tests],
|
||||
AC_HELP_STRING([--enable-external-tests],
|
||||
[Include the VTY tests in make check [default=no]]),
|
||||
|
@ -122,5 +144,6 @@ AC_OUTPUT(
|
|||
include/osmo-pcap/Makefile
|
||||
src/Makefile
|
||||
contrib/Makefile
|
||||
contrib/systemd/Makefile
|
||||
tests/Makefile
|
||||
Makefile)
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
SUBDIRS = systemd
|
||||
dist_pkgdata_DATA = osmo_pcap_clean_old
|
||||
EXTRA_DIST = osmo-pcap-server.cfg osmo-pcap-client.cfg
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
if HAVE_SYSTEMD
|
||||
SYSTEMD_SERVICES = \
|
||||
osmo-pcap-client.service \
|
||||
osmo-pcap-server.service
|
||||
|
||||
EXTRA_DIST = $(SYSTEMD_SERVICES)
|
||||
systemdsystemunit_DATA = $(SYSTEMD_SERVICES)
|
||||
endif
|
|
@ -0,0 +1,12 @@
|
|||
[Unit]
|
||||
Description=PCAP Client for the PCAP aggregation
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Restart=always
|
||||
ExecStart=/usr/bin/osmo-pcap-client -c /etc/osmocom/osmo-pcap-client.cfg
|
||||
RestartSec=2
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
[Unit]
|
||||
Description=PCAP Server for the PCAP aggregation
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Restart=always
|
||||
ExecStart=/usr/bin/osmo-pcap-server -c /etc/osmocom/osmo-pcap-server.cfg
|
||||
RestartSec=2
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
@ -1 +1,2 @@
|
|||
lib/systemd/system/osmo-pcap-client.service
|
||||
usr/bin/osmo-pcap-client
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
lib/systemd/system/osmo-pcap-server.service
|
||||
usr/bin/osmo-pcap-server
|
||||
|
|
|
@ -16,6 +16,7 @@ PCAP_LIBS="-lpcap"
|
|||
|
||||
override_dh_auto_configure:
|
||||
dh_auto_configure -- \
|
||||
--with-systemdsystemunitdir=/lib/systemd/system \
|
||||
--with-pcap-config=/bin/false \
|
||||
PCAP_CFLAGS=$(PCAP_CFLAGS) \
|
||||
PCAP_LIBS=$(PCAP_LIBS)
|
||||
|
|
Loading…
Reference in New Issue