Subject: [PATCH v2] testing/minisatip: new aport

From: lgehr <[email-masked]>
Date: Sat, 11 Feb 2023 18:45:02 +0100

https://github.com/catalinii/minisatip
minisatip is an SATIP server for linux using local DVB-S2, DVB-C, DVB-T or ATSC cards
---
As suggested by @psykose comments in MR 44091.
The libsan sed-comments are still there because they are needed for
check().
I updated pkgrel to restart the GitLab pipelines, don't know if this is
necessary.
Let me know if there is anything else

 testing/minisatip/APKBUILD                    | 55 +++++++++++++++++++
 testing/minisatip/default_document_root.patch | 11 ++++
 testing/minisatip/minisatip.confd             |  2 +
 testing/minisatip/minisatip.initd             | 13 +++++
 testing/minisatip/minisatip.pre-install       |  7 +++
 5 files changed, 88 insertions(+)
 create mode 100644 testing/minisatip/APKBUILD
 create mode 100644 testing/minisatip/default_document_root.patch
 create mode 100644 testing/minisatip/minisatip.confd
 create mode 100644 testing/minisatip/minisatip.initd
 create mode 100644 testing/minisatip/minisatip.pre-install

diff --git a/testing/minisatip/APKBUILD b/testing/minisatip/APKBUILD
new file mode 100644
index 00000000000..eb195ea234d
--- /dev/null
+++ b/testing/minisatip/APKBUILD
@@ -0,0 +1,55 @@
+# Maintainer: lgehr <[email-masked]>
+pkgname=minisatip
+pkgver=1.2.65
+pkgrel=1
+pkgdesc="minisatip is an SATIP server for linux using local DVB-S2, DVB-C, DVB-T or ATSC cards"
+url="https://minisatip.org"
+arch="all"
+license="GPL-2.0-or-later"
+makedepends="linux-headers openssl-dev libdvbcsa-dev"
+install="$pkgname.pre-install"
+subpackages="$pkgname-openrc"
+source="
+	$pkgname-$pkgver.tar.gz::https://github.com/catalinii/minisatip/archive/refs/tags/v$pkgver.tar.gz
+	minisatip.initd
+	minisatip.confd
+	default_document_root.patch
+	"
+
+build() {
+	export CFLAGS="$CFLAGS -DNO_BACKTRACE" #execinfo.h is not supported by musl
+	#libasan does not work on musl see issue #10304
+	sed -i 's; -fsanitize=address;;g' src/Makefile.in tests/Makefile.in
+	sed -i 's; -fsanitize=leak;;g' src/Makefile.in tests/Makefile.in
+	sed -i 's; -fsanitize=null;;g' src/Makefile.in tests/Makefile.in
+	./configure \
+		--build=$CBUILD \
+		--host=$CHOST \
+		--prefix=/usr \
+		--sysconfdir=/etc \
+		--mandir=/usr/share/man \
+		--localstatedir=/var
+	make
+}
+
+check() {
+	make -j1 test #parallel execution fails with "text file busy"
+}
+
+package() {
+	install -Dm755 minisatip "$pkgdir"/usr/bin/minisatip
+	mkdir -p "$pkgdir"/usr/share/minisatip/html
+	cp -r html "$pkgdir"/usr/share/minisatip
+
+	install -m755 -D "$srcdir"/$pkgname.initd \
+		"$pkgdir"/etc/init.d/$pkgname
+	install -m644 -D "$srcdir"/$pkgname.confd \
+		"$pkgdir"/etc/conf.d/$pkgname
+}
+
+sha512sums="
+9300485220dfc952e62fafbffd5e3d392619124f60bb7ac145dc41d3304532218f21d8bcd157ce6fd5f740ba86f3b85fbcbdd0fa10c1b5605ff2be44c4cdb9b7  minisatip-1.2.65.tar.gz
+fb0c4125350dbb516fb005ee0246d9219bb7c38a0429fc714bd861990cfa8c13e5e217f5be9cf7216a0f5e912ef1fb6d21e93e98b303286332f66dfee6936460  minisatip.initd
+b29b2d4140b2c66431fdf876c0f15f98794be185c786cce7c5c202484e8c73c8b17aa564c37bdca22157fa97ac5598a8c16b58699559b1bd39e4a5c18835bccd  minisatip.confd
+1e04287338545a59e690acb6719e96d2f1c196d94882148ee887e272559341e5afd681c73627463690f4a3640fb13abe86772fcfc0b8ab8f3ffe0f891d3282f8  default_document_root.patch
+"
diff --git a/testing/minisatip/default_document_root.patch b/testing/minisatip/default_document_root.patch
new file mode 100644
index 00000000000..34d571a76fb
--- /dev/null
+++ b/testing/minisatip/default_document_root.patch
@@ -0,0 +1,11 @@
+--- a/src/minisatip.c
++++ b/src/minisatip.c
+@@ -659,7 +659,7 @@
+ #ifndef DISABLE_SATIPCLIENT
+     opts.satip_addpids = 1;
+ #endif
+-    opts.document_root = "html";
++    opts.document_root = "/usr/share/minisatip/html";
+     opts.cache_dir = "/var/cache/minisatip";
+     opts.xml_path = DESC_XML;
+     opts.th_priority = -1;
diff --git a/testing/minisatip/minisatip.confd b/testing/minisatip/minisatip.confd
new file mode 100644
index 00000000000..558669db98f
--- /dev/null
+++ b/testing/minisatip/minisatip.confd
@@ -0,0 +1,2 @@
+supervisor=supervise-daemon
+extra_opts="--syslog"
diff --git a/testing/minisatip/minisatip.initd b/testing/minisatip/minisatip.initd
new file mode 100644
index 00000000000..386b13dfe26
--- /dev/null
+++ b/testing/minisatip/minisatip.initd
@@ -0,0 +1,13 @@
+#!/sbin/openrc-run
+command="/usr/bin/minisatip"
+command_args="-f $extra_opts"
+command_background="yes"
+pidfile="/run/$RC_SVCNAME.pid"
+command_user="minisatip:minisatip"
+capabilities="^cap_net_bind_service"
+
+depend() {
+	need net
+	use logger dns
+	after firewall
+}
diff --git a/testing/minisatip/minisatip.pre-install b/testing/minisatip/minisatip.pre-install
new file mode 100644
index 00000000000..8e64a72b60f
--- /dev/null
+++ b/testing/minisatip/minisatip.pre-install
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+addgroup -S minisatip 2>/dev/null
+adduser -S -D -H -s /sbin/nologin -G minisatip -g minisatip minisatip 2>/dev/null
+adduser minisatip video
+
+exit 0
-- 
2.39.1