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

2018-11-02 Thread Pau Espin Pedrol
Pau Espin Pedrol has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/11545 )

Change subject: Install systemd services with autotools
..

Install systemd services with autotools

Change-Id: Id938f3dab4826ac748abb5e0b169d800c2a625a5
---
M Makefile.am
M configure.ac
M contrib/Makefile.am
A contrib/systemd/Makefile.am
A contrib/systemd/osmo-pcap-client.service
A contrib/systemd/osmo-pcap-server.service
M debian/osmo-pcap-client.install
M debian/osmo-pcap-server.install
M debian/rules
9 files changed, 63 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/Makefile.am b/Makefile.am
index 6caa009..0f4a249 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -5,6 +5,10 @@
 BUILT_SOURCES = $(top_srcdir)/.version
 EXTRA_DIST = git-version-gen .version

+DISTCHECK_CONFIGURE_FLAGS = \
+   --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir)
+
+
 @RELMAKE@

 $(top_srcdir)/.version:
diff --git a/configure.ac b/configure.ac
index b5468ee..f885e6d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -19,6 +19,13 @@
 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 @@
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 @@
 include/osmo-pcap/Makefile
 src/Makefile
 contrib/Makefile
+contrib/systemd/Makefile
 tests/Makefile
 Makefile)
diff --git a/contrib/Makefile.am b/contrib/Makefile.am
index 3585924..7bd8c23 100644
--- a/contrib/Makefile.am
+++ b/contrib/Makefile.am
@@ -1,2 +1,3 @@
+SUBDIRS = systemd
 dist_pkgdata_DATA = osmo_pcap_clean_old
 EXTRA_DIST = osmo-pcap-server.cfg osmo-pcap-client.cfg
diff --git a/contrib/systemd/Makefile.am b/contrib/systemd/Makefile.am
new file mode 100644
index 000..5b41c52
--- /dev/null
+++ b/contrib/systemd/Makefile.am
@@ -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
diff --git a/contrib/systemd/osmo-pcap-client.service 
b/contrib/systemd/osmo-pcap-client.service
new file mode 100644
index 000..fd0de75
--- /dev/null
+++ b/contrib/systemd/osmo-pcap-client.service
@@ -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
+
diff --git a/contrib/systemd/osmo-pcap-server.service 
b/contrib/systemd/osmo-pcap-server.service
new file mode 100644
index 000..3094fc4
--- /dev/null
+++ b/contrib/systemd/osmo-pcap-server.service
@@ -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
+
diff --git a/debian/osmo-pcap-client.install b/debian/osmo-pcap-client.install
index f149b14..ac7c65c 100644
--- a/debian/osmo-pcap-client.install
+++ b/debian/osmo-pcap-client.install
@@ -1 +1,2 @@
+lib/systemd/system/osmo-pcap-client.service
 usr/bin/osmo-pcap-client
diff --git a/debian/osmo-pcap-server.install b/debian/osmo-pcap-server.install
index ad58c8e..6ba698e 100644
--- a/debian/osmo-pcap-server.install
+++ b/debian/osmo-pcap-server.install
@@ -1 +1,2 @@
+lib/systemd/system/osmo-pcap-server.service
 usr/bin/osmo-pcap-server
diff --git a/debian/rules 

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

2018-10-31 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/11545 )

Change subject: Install systemd services with autotools
..


Patch Set 2: Code-Review+2


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

Gerrit-Project: osmo-pcap
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Id938f3dab4826ac748abb5e0b169d800c2a625a5
Gerrit-Change-Number: 11545
Gerrit-PatchSet: 2
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Jenkins Builder (102)
Gerrit-Comment-Date: Wed, 31 Oct 2018 22:12:00 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


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

2018-10-31 Thread Pau Espin Pedrol
Hello Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/11545

to look at the new patch set (#2).

Change subject: Install systemd services with autotools
..

Install systemd services with autotools

Change-Id: Id938f3dab4826ac748abb5e0b169d800c2a625a5
---
M Makefile.am
M configure.ac
M contrib/Makefile.am
A contrib/systemd/Makefile.am
A contrib/systemd/osmo-pcap-client.service
A contrib/systemd/osmo-pcap-server.service
M debian/osmo-pcap-client.install
M debian/osmo-pcap-server.install
M debian/rules
9 files changed, 63 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-pcap refs/changes/45/11545/2
--
To view, visit https://gerrit.osmocom.org/11545
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcap
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Id938f3dab4826ac748abb5e0b169d800c2a625a5
Gerrit-Change-Number: 11545
Gerrit-PatchSet: 2
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Jenkins Builder (102)


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

2018-10-31 Thread Pau Espin Pedrol
Pau Espin Pedrol has uploaded this change for review. ( 
https://gerrit.osmocom.org/11545


Change subject: Install systemd services with autotools
..

Install systemd services with autotools

Change-Id: Id938f3dab4826ac748abb5e0b169d800c2a625a5
---
M Makefile.am
M configure.ac
M contrib/Makefile.am
A contrib/systemd/Makefile.am
A contrib/systemd/osmo-pcap-client.service
A contrib/systemd/osmo-pcap-server.service
M debian/osmo-pcap-client.install
M debian/osmo-pcap-server.install
M debian/rules
9 files changed, 56 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-pcap refs/changes/45/11545/1

diff --git a/Makefile.am b/Makefile.am
index 6caa009..61eb85d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -5,6 +5,10 @@
 BUILT_SOURCES = $(top_srcdir)/.version
 EXTRA_DIST = git-version-gen .version

+DISTCHECK_CONFIGURE_FLAGS = \
+  --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir)
+
+
 @RELMAKE@

 $(top_srcdir)/.version:
diff --git a/configure.ac b/configure.ac
index b5468ee..a0f786f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -52,6 +52,21 @@
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 +137,6 @@
 include/osmo-pcap/Makefile
 src/Makefile
 contrib/Makefile
+contrib/systemd/Makefile
 tests/Makefile
 Makefile)
diff --git a/contrib/Makefile.am b/contrib/Makefile.am
index 3585924..7bd8c23 100644
--- a/contrib/Makefile.am
+++ b/contrib/Makefile.am
@@ -1,2 +1,3 @@
+SUBDIRS = systemd
 dist_pkgdata_DATA = osmo_pcap_clean_old
 EXTRA_DIST = osmo-pcap-server.cfg osmo-pcap-client.cfg
diff --git a/contrib/systemd/Makefile.am b/contrib/systemd/Makefile.am
new file mode 100644
index 000..49a2625
--- /dev/null
+++ b/contrib/systemd/Makefile.am
@@ -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
diff --git a/contrib/systemd/osmo-pcap-client.service 
b/contrib/systemd/osmo-pcap-client.service
new file mode 100644
index 000..fd0de75
--- /dev/null
+++ b/contrib/systemd/osmo-pcap-client.service
@@ -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
+
diff --git a/contrib/systemd/osmo-pcap-server.service 
b/contrib/systemd/osmo-pcap-server.service
new file mode 100644
index 000..3094fc4
--- /dev/null
+++ b/contrib/systemd/osmo-pcap-server.service
@@ -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
+
diff --git a/debian/osmo-pcap-client.install b/debian/osmo-pcap-client.install
index f149b14..ac7c65c 100644
--- a/debian/osmo-pcap-client.install
+++ b/debian/osmo-pcap-client.install
@@ -1 +1,2 @@
+lib/systemd/system/osmo-pcap-client.service
 usr/bin/osmo-pcap-client
diff --git a/debian/osmo-pcap-server.install b/debian/osmo-pcap-server.install
index ad58c8e..6ba698e 100644
--- a/debian/osmo-pcap-server.install
+++ b/debian/osmo-pcap-server.install
@@ -1 +1,2 @@
+lib/systemd/system/osmo-pcap-server.service
 usr/bin/osmo-pcap-server
diff --git a/debian/rules b/debian/rules
index 6862888..a9a8b30 100755
--- a/debian/rules
+++ b/debian/rules
@@ -16,6 +16,7 @@

 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)

--
To view, visit