osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/erlang/osmo_dia2gsup/+/28605 )
Change subject: debian: add packaging ......................................................................
debian: add packaging
Add initial debian packaging and a systemd service that starts osmo_dia2gsup. Given that rebar3 and the dependencies listed in rebar.lock are not packaged in debian 11, this just downloads the official binary of rebar3 and uses it to download and compile the dependencies during the build.
Resulting erlang files are installed to the following path, where they become available in the erlang shell (erl): /lib/erlang/lib/{name_of_component}/ebin/
Related: SYS#6006 Change-Id: Ic55bca1260f992d0ed8583e7c7fe948ba0160d4d --- M .gitignore A contrib/systemd/osmo_dia2gsup.service A debian/changelog A debian/compat A debian/control A debian/download_rebar3.sh A debian/osmo-diameter2gsup.install A debian/rules A debian/source/format 9 files changed, 81 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/erlang/osmo_dia2gsup refs/changes/05/28605/1
diff --git a/.gitignore b/.gitignore index 587d7e9..4669194 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,11 @@ src/diameter_3gpp* src/diameter_rfc* src/diameter_etsi* + +/rebar3 + +/debian/*.debhelper +/debian/files +/debian/osmo-diameter2gsup.substvars +/debian/osmo-diameter2gsup/ +/debian/debhelper-build-stamp diff --git a/contrib/systemd/osmo_dia2gsup.service b/contrib/systemd/osmo_dia2gsup.service new file mode 100644 index 0000000..3ae9b68 --- /dev/null +++ b/contrib/systemd/osmo_dia2gsup.service @@ -0,0 +1,14 @@ +[Unit] +Description=Osmocom DIAMETER to GSUP translator +After=osmo-hlr.service + +[Service] +Type=simple +Restart=always +Environment="HOME=/var/lib/osmo_dia2gsup" +ExecStartPre=/usr/bin/mkdir -p /var/lib/osmo_dia2gsup +ExecStart=/usr/bin/erl -noshell -sname osmo_dia2gsup -eval "osmo_dia2gsup:start()." +RestartSec=2 + +[Install] +WantedBy=multi-user.target diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..6e45d35 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +osmo-diameter2gsup (0.1.0) unstable; urgency=medium + + * Initial release. + + -- Oliver Smith osmith@sysmocom.de Wed, 14 Jul 2022 14:51:01 +0200 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..f599e28 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +10 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..d3ebc4f --- /dev/null +++ b/debian/control @@ -0,0 +1,17 @@ +Source: osmo-diameter2gsup +Maintainer: Osmocom Community openbsc@lists.osmocom.org +Section: net +Priority: optional +Build-Depends: erlang-nox, + libpcap-dev, + wget, +Standards-Version: 4.5.0 + +Package: osmo-diameter2gsup +Architecture: any +Depends: erlang-nox +Multi-Arch: allowed +Description: Osmocom DIAMETER to GSUP translator + This can be used to translate DIAMETER requests (such as those by an EPC) + to the Osmocom specific GSUP protocol, which means you can use OsmoHLR + as a simplistic HSS. diff --git a/debian/download_rebar3.sh b/debian/download_rebar3.sh new file mode 100755 index 0000000..2b524a5 --- /dev/null +++ b/debian/download_rebar3.sh @@ -0,0 +1,14 @@ +#!/bin/sh -e +# HACK: rebar3 is not packaged for debian 11. Use the official release binary +# for now. + +REBAR3_VERSION=3.19.0 + +if [ -x ./rebar3 ]; then + echo "rebar3 already downloaded" + exit 0 +fi + +set -x +wget "https://github.com/erlang/rebar3/releases/download/$REBAR3_VERSION/rebar3" +chmod +x rebar3 diff --git a/debian/osmo-diameter2gsup.install b/debian/osmo-diameter2gsup.install new file mode 100644 index 0000000..6d442ad --- /dev/null +++ b/debian/osmo-diameter2gsup.install @@ -0,0 +1,2 @@ +/contrib/systemd/osmo_dia2gsup.service /lib/systemd/system/ +/_lib/* /usr/lib/erlang/lib/ diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..0e7444c --- /dev/null +++ b/debian/rules @@ -0,0 +1,19 @@ +#!/usr/bin/make -f + +build: + debian/download_rebar3.sh + ./rebar3 compile + ./rebar3 escriptize + ./rebar3 eunit + for i in _build/default/lib/*; do \ + libdir=_lib/"$$(basename "$$i")"; \ + mkdir -pv "$$libdir"; \ + cp -rv "$$i/ebin" "$$libdir"; \ + done + find _lib -name .empty -delete + +clean: + rm -rf _build _lib + +%: + dh $@ diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..89ae9db --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (native)