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

2018-09-12 Thread Pau Espin Pedrol
Pau Espin Pedrol has uploaded this change for review. ( 
https://gerrit.osmocom.org/10898


Change subject: Install systemd services with autotools
..

Install systemd services with autotools

Change-Id: I87299134696bbfc6721b1226d4de6c73854aa846
---
M Makefile.am
M configure.ac
A contrib/Makefile.am
D contrib/sysmobts.service
A contrib/systemd/Makefile.am
R contrib/systemd/lc15bts-mgr.service
R contrib/systemd/osmo-bts-lc15.service
R contrib/systemd/osmo-bts-sysmo.service
R contrib/systemd/sysmobts-mgr.service
M debian/osmo-bts-trx.install
D debian/osmo-bts-trx.service
M debian/osmo-bts-virtual.install
D debian/osmo-bts-virtual.service
M debian/rules
14 files changed, 45 insertions(+), 25 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/98/10898/1

diff --git a/Makefile.am b/Makefile.am
index 10ff2d2..b573aa8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,11 +1,11 @@
 AUTOMAKE_OPTIONS = foreign dist-bzip2 1.6

-SUBDIRS = include src tests doc
+SUBDIRS = include src tests doc contrib


 # package the contrib and doc
 EXTRA_DIST = \
-   contrib/dump_docs.py contrib/screenrc-l1fwd 
contrib/osmo-bts-sysmo.service \
+   contrib/dump_docs.py contrib/screenrc-l1fwd \
contrib/l1fwd.init contrib/screenrc-sysmobts contrib/respawn.sh \
doc/examples/sysmo/osmo-bts.cfg \
doc/examples/sysmo/sysmobts-mgr.cfg \
@@ -14,6 +14,9 @@
git-version-gen .version \
README.md

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

 BUILT_SOURCES = $(top_srcdir)/.version
diff --git a/configure.ac b/configure.ac
index aad55db..38e6713 100644
--- a/configure.ac
+++ b/configure.ac
@@ -279,6 +279,22 @@
CPPFLAGS=$oldCPPFLAGS
 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_MSG_RESULT([CFLAGS="$CFLAGS"])
 AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"])

@@ -307,4 +323,6 @@
 tests/meas/Makefile
 doc/Makefile
 doc/examples/Makefile
+contrib/Makefile
+contrib/systemd/Makefile
 Makefile)
diff --git a/contrib/Makefile.am b/contrib/Makefile.am
new file mode 100644
index 000..3439c97
--- /dev/null
+++ b/contrib/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = systemd
diff --git a/contrib/sysmobts.service b/contrib/sysmobts.service
deleted file mode 100644
index 64e0127..000
--- a/contrib/sysmobts.service
+++ /dev/null
@@ -1,20 +0,0 @@
-[Unit]
-Description=sysmocom sysmoBTS
-
-[Service]
-Type=simple
-ExecStartPre=/bin/sh -c 'echo 0 > /sys/class/leds/activity_led/brightness'
-ExecStart=/usr/bin/osmo-bts-sysmo -s -c /etc/osmocom/osmo-bts.cfg -M
-ExecStopPost=/bin/sh -c 'echo 0 > /sys/class/leds/activity_led/brightness'
-ExecStopPost=/bin/sh -c 'cat /lib/firmware/sysmobts-v?.bit > /dev/fpgadl_par0 
; sleep 3s; cat /lib/firmware/sysmobts-v?.out > /dev/dspdl_dm644x_0; sleep 1s'
-Restart=always
-RestartSec=2
-RestartPreventExitStatus=1
-
-# The msg queues must be read fast enough
-CPUSchedulingPolicy=rr
-CPUSchedulingPriority=1
-
-[Install]
-WantedBy=multi-user.target
-Alias=osmo-bts-sysmo.service
diff --git a/contrib/systemd/Makefile.am b/contrib/systemd/Makefile.am
new file mode 100644
index 000..1646308
--- /dev/null
+++ b/contrib/systemd/Makefile.am
@@ -0,0 +1,18 @@
+if HAVE_SYSTEMD
+SYSTEMD_SERVICES = osmo-bts-virtual.service
+
+if ENABLE_SYSMOBTS
+SYSTEMD_SERVICES += osmo-bts-sysmo.service sysmobts-mgr.service
+endif
+
+if ENABLE_TRX
+SYSTEMD_SERVICES += osmo-bts-trx.service
+endif
+
+if ENABLE_LC15BTS
+SYSTEMD_SERVICES += osmo-bts-lc15.service lc15bts-mgr.service
+endif
+
+EXTRA_DIST = $(SYSTEMD_SERVICES)
+systemdsystemunit_DATA = $(SYSTEMD_SERVICES)
+endif # HAVE_SYSTEMD
diff --git a/contrib/lc15bts-mgr.service b/contrib/systemd/lc15bts-mgr.service
similarity index 100%
rename from contrib/lc15bts-mgr.service
rename to contrib/systemd/lc15bts-mgr.service
diff --git a/contrib/osmo-bts-lc15.service 
b/contrib/systemd/osmo-bts-lc15.service
similarity index 100%
rename from contrib/osmo-bts-lc15.service
rename to contrib/sys

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

2018-09-13 Thread Harald Welte
Harald Welte has posted comments on this change. ( 
https://gerrit.osmocom.org/10898 )

Change subject: Install systemd services with autotools
..


Patch Set 1: Code-Review+2


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

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I87299134696bbfc6721b1226d4de6c73854aa846
Gerrit-Change-Number: 10898
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Comment-Date: Thu, 13 Sep 2018 13:52:17 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


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

2018-09-13 Thread Pau Espin Pedrol
Pau Espin Pedrol has posted comments on this change. ( 
https://gerrit.osmocom.org/10898 )

Change subject: Install systemd services with autotools
..


Patch Set 1: Verified+1


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

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I87299134696bbfc6721b1226d4de6c73854aa846
Gerrit-Change-Number: 10898
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol 
Gerrit-Reviewer: Harald Welte 
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Comment-Date: Thu, 13 Sep 2018 13:56:45 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


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

2018-09-13 Thread Pau Espin Pedrol
Pau Espin Pedrol has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/10898 )

Change subject: Install systemd services with autotools
..

Install systemd services with autotools

Change-Id: I87299134696bbfc6721b1226d4de6c73854aa846
---
M Makefile.am
M configure.ac
A contrib/Makefile.am
D contrib/sysmobts.service
A contrib/systemd/Makefile.am
R contrib/systemd/lc15bts-mgr.service
R contrib/systemd/osmo-bts-lc15.service
R contrib/systemd/osmo-bts-sysmo.service
R contrib/systemd/sysmobts-mgr.service
M debian/osmo-bts-trx.install
D debian/osmo-bts-trx.service
M debian/osmo-bts-virtual.install
D debian/osmo-bts-virtual.service
M debian/rules
14 files changed, 45 insertions(+), 25 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Pau Espin Pedrol: Verified



diff --git a/Makefile.am b/Makefile.am
index 10ff2d2..b573aa8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,11 +1,11 @@
 AUTOMAKE_OPTIONS = foreign dist-bzip2 1.6

-SUBDIRS = include src tests doc
+SUBDIRS = include src tests doc contrib


 # package the contrib and doc
 EXTRA_DIST = \
-   contrib/dump_docs.py contrib/screenrc-l1fwd 
contrib/osmo-bts-sysmo.service \
+   contrib/dump_docs.py contrib/screenrc-l1fwd \
contrib/l1fwd.init contrib/screenrc-sysmobts contrib/respawn.sh \
doc/examples/sysmo/osmo-bts.cfg \
doc/examples/sysmo/sysmobts-mgr.cfg \
@@ -14,6 +14,9 @@
git-version-gen .version \
README.md

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

 BUILT_SOURCES = $(top_srcdir)/.version
diff --git a/configure.ac b/configure.ac
index aad55db..38e6713 100644
--- a/configure.ac
+++ b/configure.ac
@@ -279,6 +279,22 @@
CPPFLAGS=$oldCPPFLAGS
 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_MSG_RESULT([CFLAGS="$CFLAGS"])
 AC_MSG_RESULT([CPPFLAGS="$CPPFLAGS"])

@@ -307,4 +323,6 @@
 tests/meas/Makefile
 doc/Makefile
 doc/examples/Makefile
+contrib/Makefile
+contrib/systemd/Makefile
 Makefile)
diff --git a/contrib/Makefile.am b/contrib/Makefile.am
new file mode 100644
index 000..3439c97
--- /dev/null
+++ b/contrib/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = systemd
diff --git a/contrib/sysmobts.service b/contrib/sysmobts.service
deleted file mode 100644
index 64e0127..000
--- a/contrib/sysmobts.service
+++ /dev/null
@@ -1,20 +0,0 @@
-[Unit]
-Description=sysmocom sysmoBTS
-
-[Service]
-Type=simple
-ExecStartPre=/bin/sh -c 'echo 0 > /sys/class/leds/activity_led/brightness'
-ExecStart=/usr/bin/osmo-bts-sysmo -s -c /etc/osmocom/osmo-bts.cfg -M
-ExecStopPost=/bin/sh -c 'echo 0 > /sys/class/leds/activity_led/brightness'
-ExecStopPost=/bin/sh -c 'cat /lib/firmware/sysmobts-v?.bit > /dev/fpgadl_par0 
; sleep 3s; cat /lib/firmware/sysmobts-v?.out > /dev/dspdl_dm644x_0; sleep 1s'
-Restart=always
-RestartSec=2
-RestartPreventExitStatus=1
-
-# The msg queues must be read fast enough
-CPUSchedulingPolicy=rr
-CPUSchedulingPriority=1
-
-[Install]
-WantedBy=multi-user.target
-Alias=osmo-bts-sysmo.service
diff --git a/contrib/systemd/Makefile.am b/contrib/systemd/Makefile.am
new file mode 100644
index 000..1646308
--- /dev/null
+++ b/contrib/systemd/Makefile.am
@@ -0,0 +1,18 @@
+if HAVE_SYSTEMD
+SYSTEMD_SERVICES = osmo-bts-virtual.service
+
+if ENABLE_SYSMOBTS
+SYSTEMD_SERVICES += osmo-bts-sysmo.service sysmobts-mgr.service
+endif
+
+if ENABLE_TRX
+SYSTEMD_SERVICES += osmo-bts-trx.service
+endif
+
+if ENABLE_LC15BTS
+SYSTEMD_SERVICES += osmo-bts-lc15.service lc15bts-mgr.service
+endif
+
+EXTRA_DIST = $(SYSTEMD_SERVICES)
+systemdsystemunit_DATA = $(SYSTEMD_SERVICES)
+endif # HAVE_SYSTEMD
diff --git a/contrib/lc15bts-mgr.service b/contrib/systemd/lc15bts-mgr.service
similarity index 100%
rename from contrib/lc15bts-mgr.service
rename to contrib/systemd/lc15bts-mgr.service
diff --git a/contrib/osmo-bts-lc15.service 
b/contrib/systemd/osmo-bts-lc15.service
similarity index 100%
rename from contrib/osmo-bts-lc15.service
rena