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

From: Alex McGrath <[email-masked]>
Date: Sat, 25 Jul 2020 20:46:13 +0100

https://github.com/sentriz/gonic/
A subsonic compatible music streaming server
---
Sorry, I'd accidentially made two commits
 testing/gonic/APKBUILD          | 52 +++++++++++++++++++++++++++++++++
 testing/gonic/gonic.confd       |  7 +++++
 testing/gonic/gonic.initd       | 19 ++++++++++++
 testing/gonic/gonic.pre-install |  6 ++++
 4 files changed, 84 insertions(+)
 create mode 100644 testing/gonic/APKBUILD
 create mode 100644 testing/gonic/gonic.confd
 create mode 100644 testing/gonic/gonic.initd
 create mode 100644 testing/gonic/gonic.pre-install

diff --git a/testing/gonic/APKBUILD b/testing/gonic/APKBUILD
new file mode 100644
index 0000000000..4fb85d34ff
--- /dev/null
+++ b/testing/gonic/APKBUILD
@@ -0,0 +1,52 @@
+# Contributor: Alex McGrath <[email-masked]>
+# Maintainer: Alex McGrath <[email-masked]>
+pkgname=gonic
+pkgver=0.10.0
+pkgrel=0
+pkgdesc="A subsonic compatible music streaming server"
+url="https://github.com/sentriz/gonic"
+arch="all"
+license="GPL-3.0"
+subpackages="$pkgname-openrc"
+depends="taglib ffmpeg alsa-lib sqlite"
+makedepends="binutils-gold go alsa-lib-dev taglib-dev"
+install="$pkgname.pre-install"
+source="
+	gonic.initd
+	gonic.confd
+	gonic-$pkgver.tar.gz::https://github.com/sentriz/gonic/archive/v$pkgver.tar.gz
+	"
+builddir="$srcdir/$pkgname-$pkgver"
+
+export GOPATH="$srcdir"
+export GO111MODULES=on
+
+build() {
+	cd $builddir
+	./_do_build_server
+}
+
+check() {
+  cd $builddir
+  go test ./...
+}
+
+package() {
+	install -m755 -D "$srcdir"/$pkgname.initd \
+		"$pkgdir"/etc/init.d/$pkgname
+	install -m644 -D "$srcdir"/$pkgname.confd \
+		"$pkgdir"/etc/conf.d/$pkgname
+	install -Dm755 "$builddir"/"$pkgname" \
+		"$pkgdir"/usr/bin/"$pkgname"
+
+}
+
+cleanup_srcdir() {
+	go clean -modcache
+	default_cleanup_srcdir
+}
+
+
+sha512sums="9d571f9980b30c665e051cc0d43e71e7029c473049d0e078d84ff2c001a953b9eebc95b7d45f651d4180a37f29976cc775fa756da1661296d58eb46501901f33  gonic.initd
+473691065ab718c343483cdeca07f9d3254974f681bdbb413a0e618b3dd4fbc089d07107093a482188f11a0a41e48b84ccc7b52a99e57fd60fbb40339f5ffd2e  gonic.confd
+f0c925a6bbe92ee23b8a2922c5697d596ca1abffab9e76d15930d15cea828ae7de8cf9ff3a11a151980a9b3455ff314c1129777f277213fbd977ccc9c9a6d9bf  gonic-0.10.0.tar.gz"
diff --git a/testing/gonic/gonic.confd b/testing/gonic/gonic.confd
new file mode 100644
index 0000000000..1d14d8d0fe
--- /dev/null
+++ b/testing/gonic/gonic.confd
@@ -0,0 +1,7 @@
+# conf.d file for gonic
+
+#
+# Specify daemon options here.
+#
+MUSIC_PATH=""
+GONIC_OPTS="-music-path=$MUSIC_PATH -db-path=/var/lib/gonic/gonic.db"
diff --git a/testing/gonic/gonic.initd b/testing/gonic/gonic.initd
new file mode 100644
index 0000000000..d7f331ac8e
--- /dev/null
+++ b/testing/gonic/gonic.initd
@@ -0,0 +1,19 @@
+#!/sbin/openrc-run
+
+name=gonic
+command="/usr/bin/gonic"
+command_args="$GONIC_OPTS"
+command_background=true
+pidfile="/var/run/${RC_SVCNAME}.pid"
+error_log="/var/log/gonic.log"
+command_user="gonic:gonic"
+
+start_pre() {
+	checkpath -W --owner "$command_user" --mode 0644 \
+		/var/log/gonic.log
+}
+
+depend() {
+        need net
+        after firewall
+}
\ No newline at end of file
diff --git a/testing/gonic/gonic.pre-install b/testing/gonic/gonic.pre-install
new file mode 100644
index 0000000000..fcf0352fc2
--- /dev/null
+++ b/testing/gonic/gonic.pre-install
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+addgroup -S gonic 2>/dev/null
+adduser -S -D -H -s /bin/false -G gonic -g gonic gonic 2>/dev/null
+
+exit 0
-- 
2.26.2