Subject: [PATCH v2] testing/prosody-filer: new aport

From: Galen Abell <[email-masked]>
Date: Sat, 7 Dec 2019 12:35:47 +0100

https://github.com/ThomasLeister/prosody-filer
Golang mod_http_upload_external server for Prosody and Ejabberd
testing/
---
v2 fixes building on systems without GOPATH already set up

 testing/prosody-filer/APKBUILD                | 48 +++++++++++++++++++
 testing/prosody-filer/prosody-filer.confd     | 19 ++++++++
 testing/prosody-filer/prosody-filer.initd     | 19 ++++++++
 .../prosody-filer/prosody-filer.pre-install   | 11 +++++
 4 files changed, 97 insertions(+)
 create mode 100644 testing/prosody-filer/APKBUILD
 create mode 100644 testing/prosody-filer/prosody-filer.confd
 create mode 100644 testing/prosody-filer/prosody-filer.initd
 create mode 100644 testing/prosody-filer/prosody-filer.pre-install

diff --git a/testing/prosody-filer/APKBUILD b/testing/prosody-filer/APKBUILD
new file mode 100644
index 0000000000..f027e350fd
--- /dev/null
+++ b/testing/prosody-filer/APKBUILD
@@ -0,0 +1,48 @@
+# Contributor: Galen Abell <[email-masked]>
+# Maintainer: Galen Abell <[email-masked]>
+pkgname="prosody-filer"
+pkgver="1.0.0"
+pkgrel=0
+pkgdesc="Golang mod_http_upload_external server for Prosody and Ejabberd"
+url="https://github.com/ThomasLeister/prosody-filer"
+arch="all"
+license="MIT"
+makedepends="go"
+options="!check" # tests are broken
+install="$pkgname.pre-install"
+subpackages="$pkgname-openrc"
+source="
+	$pkgname-$pkgver.tar.gz::https://github.com/ThomasLeister/prosody-filer/archive/v$pkgver.tar.gz
+	$pkgname.initd
+	$pkgname.confd
+"
+builddir="$srcdir/src/github.com/ThomasLeister/$pkgname"
+
+prepare() {
+	mkdir -p ${builddir%/*}
+	mv $srcdir/$pkgname-$pkgver "$builddir"/
+
+	# fetch dependencies
+	GOPATH="$srcdir" go get github.com/BurntSushi/toml
+
+	default_prepare
+}
+
+build() {
+	GO111MODULE=off GOPATH="$srcdir" go build -v -o $pkgname main.go
+}
+
+package() {
+	install -Dm755 "$builddir"/$pkgname "$pkgdir"/usr/bin/$pkgname
+	install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
+	install -Dm644 "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
+}
+
+cleanup_srcdir() {
+	go clean -modcache
+	default_cleanup_srcdir
+}
+
+sha512sums="2e05af781c2876ad61db0822290459de234fcbaa33885f573c5059c8493361ffa35c5291df9dd363cfad6bffafa98966ec53b49d7db70b75e19a7828742a9d75  prosody-filer-1.0.0.tar.gz
+1460dd00df99fe8dc04f42c65731c6b002ac5a2c5dcd73af598f2a3c6d8befa5ff1d910b5417477a3c79efc5065e609621eab6919f93c3bef34169264939929f  prosody-filer.initd
+d2ca3f7801bbf6252b3ee739aff79460ec76dbc0798ea8995d0f2b684d85347685ae3b7f2cc4cf186ad1c889fd79bc267f57f9c6c120f491afe943bf725e4abd  prosody-filer.confd"
diff --git a/testing/prosody-filer/prosody-filer.confd b/testing/prosody-filer/prosody-filer.confd
new file mode 100644
index 0000000000..1bc0331074
--- /dev/null
+++ b/testing/prosody-filer/prosody-filer.confd
@@ -0,0 +1,19 @@
+# conf.d file for prosody-filer
+
+#
+# Specify the path to the configuration file.
+#
+
+PROSODY_FILER_CONF="/etc/prosody-filer/config.toml"
+
+#
+# Specify the user the daemon should run under.
+#
+
+PROSODY_FILER_USER="prosody-filer"
+
+#
+# Specify the group the daemon should run under.
+#
+
+PROSODY_FILER_GROUP="prosody-filer"
diff --git a/testing/prosody-filer/prosody-filer.initd b/testing/prosody-filer/prosody-filer.initd
new file mode 100644
index 0000000000..5da0208f3b
--- /dev/null
+++ b/testing/prosody-filer/prosody-filer.initd
@@ -0,0 +1,19 @@
+#!/sbin/openrc-run
+
+name=$RC_SVCNAME
+command="/usr/bin/prosody-filer"
+command_args="-config ${PROSODY_FILER_CONF}"
+command_user="${PROSODY_FILER_USER}:${PROSODY_FILER_GROUP}"
+pidfile="/run/$RC_SVCNAME.pid"
+command_background=yes
+
+depend() {
+	need net
+}
+
+start_pre() {
+    if [ ! -e "${PROSODY_FILER_CONF}" ]; then
+        eerror "You must create a config file to run prosody-filer"
+        return 1
+    fi
+}
diff --git a/testing/prosody-filer/prosody-filer.pre-install b/testing/prosody-filer/prosody-filer.pre-install
new file mode 100644
index 0000000000..4d969c56c5
--- /dev/null
+++ b/testing/prosody-filer/prosody-filer.pre-install
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+addgroup -S prosody-filer 2>/dev/null
+adduser -S -D \
+    -h /var/lib/prosody-filer \
+    -s /sbin/nologin \
+    -G prosody-filer \
+    -g "Prosody Filer Server" \
+    prosody-filer 2>/dev/null
+
+exit 0
-- 
2.24.0

---

From: Galen Abell <[email-masked]>
Date: Fri, 10 Jan 2020 08:39:19 -0500

v3 upgrades to 1.0.1

index 0000000000..a0f9570536
+pkgver="1.0.1"
+sha512sums="91231c1e42d9d79a3bfa57d74ee507e9cc803640c9ebeade0049be3d89cc150089ce616cc5d26b40530230db472895646f74a680be11c36dd9c255d8390948a6  prosody-filer-1.0.1.tar.gz
2.24.1