Received: from out1.migadu.com (out1.migadu.com [91.121.223.63])
	by nld3-dev1.alpinelinux.org (Postfix) with ESMTPS id C1136780FB5
	for <~alpine/aports@lists.alpinelinux.org>; Sun, 28 Mar 2021 03:17:30 +0000 (UTC)
X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers.
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eletrotupi.com;
	s=default; t=1616901449;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:cc:mime-version:mime-version:
	 content-transfer-encoding:content-transfer-encoding;
	bh=+4syujkdHvoz6SykVm3ED/0cuWXtX60llvQABiQVlPo=;
	b=AWVYb/HtRm1pu+c5F5Qph545c32Dt38TrGA2OPL0R/mG8JE9NgldiWC5b2sj9x9t+FS0mY
	wxpWgX7eVOEkCwH2jUYcudy6Oiq9E0daSAwwGPeUiCOvKgM9QlAU31jvQ6403WWwx9U7UH
	AWPsqdKxah0ooi6+WNZuRUSiO7LjCxU=
From: Pedro Lucas Porcellis <porcellis@eletrotupi.com>
To: ~alpine/aports@lists.alpinelinux.org
Cc: Pedro Lucas Porcellis <porcellis@eletrotupi.com>
Subject: [PATCH] testing/satellite: new aport
Date: Sun, 28 Mar 2021 00:17:09 -0300
Message-Id: <20210328031709.14220-1-porcellis@eletrotupi.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Migadu-Flow: FLOW_OUT
X-Migadu-Auth-User: porcellis@eletrotupi.com

url: https://git.sr.ht/~gsthnz/satellite
pkgdesc: Satellite is a small Gemini server for serving static files
---
 testing/satellite/APKBUILD              | 41 +++++++++++++++++++++++++
 testing/satellite/satellite.confd       |  1 +
 testing/satellite/satellite.initd       | 17 ++++++++++
 testing/satellite/satellite.pre-install |  7 +++++
 4 files changed, 66 insertions(+)
 create mode 100644 testing/satellite/APKBUILD
 create mode 100644 testing/satellite/satellite.confd
 create mode 100644 testing/satellite/satellite.initd
 create mode 100644 testing/satellite/satellite.pre-install

diff --git a/testing/satellite/APKBUILD b/testing/satellite/APKBUILD
new file mode 100644
index 0000000000..e78f602503
--- /dev/null
+++ b/testing/satellite/APKBUILD
@@ -0,0 +1,41 @@
+# Maintainer: Pedro Lucas Porcellis <porcellis@eletrotupi.com>
+pkgname=satellite
+pkgver=1.0.0
+pkgrel=1
+pkgdesc="Satellite is a small Gemini server for serving static files"
+url="https://git.sr.ht/~gsthnz/satellite"
+arch="all"
+license="AGPLv3"
+subpackages="$pkgname-openrc"
+makedepends="go scdoc"
+install="$pkgname.pre-install"
+source="
+	$pkgname-$pkgver.tar.gz::https://git.sr.ht/~gsthnz/$pkgname/archive/v$pkgver.tar.gz
+	$pkgname.initd
+	$pkgname.confd
+"
+pkggroups="satellite"
+builddir="$srcdir/$pkgname-v$pkgver"
+
+build() {
+	make
+}
+
+check() {
+	go test ./...
+}
+
+package() {
+	install -Dm755 $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
+
+	install -Dm640 -o root -g satellite "$builddir"/$pkgname.toml \
+		"$pkgdir"/etc/$pkgname.toml
+
+	install -Dm644 doc/satellite.1 "$builddir"/usr/share/man/man1/satellite.1
+	install -Dm644 doc/satellite.toml.5 "$builddir"/usr/share/man/man5/satellite.toml.5
+}
+sha512sums="2b14e6bd7a1b33a0b4cf402e64585f9f87d2491709bd2f383ec0777b24a372fa7360ca7da96d21e61790095554c8029b07cdddc7a23688465ee77f7854beea48  satellite-1.0.0.tar.gz
+dcf84f7f09651426189280df73ce683b5a88bc40764e1ae5e0993fe2d9a796e36437c5f064fae120d749f8fd0151ef11296210556408a04441fc01e571f8f6cb  satellite.initd
+f20f287640743ede9139a12fb7cbbcc9f2f51bc179322e04253e236daf55090aa043e9e01ec7f29cadc965cdb73bbaa86080072840913c88503138df8a04e443  satellite.confd"
diff --git a/testing/satellite/satellite.confd b/testing/satellite/satellite.confd
new file mode 100644
index 0000000000..4a0e714c53
--- /dev/null
+++ b/testing/satellite/satellite.confd
@@ -0,0 +1 @@
+satellite_log_file="/var/log/satellite.log"
diff --git a/testing/satellite/satellite.initd b/testing/satellite/satellite.initd
new file mode 100644
index 0000000000..431408940a
--- /dev/null
+++ b/testing/satellite/satellite.initd
@@ -0,0 +1,17 @@
+#!/sbin/openrc-run
+name="satellite"
+description="satellite gemini service"
+supervisor=supervise-daemon
+command="/usr/bin/$name"
+command_user="satellite:satellite"
+pidfile="/run/$name.pid"
+start_stop_daemon_args="--stdout $satellite_log_file --stderr $satellite_log_file"
+
+depend() {
+	need net
+	after firewall
+}
+
+start_pre() {
+	checkpath -f -m 0644 -o ${SVCNAME}:${SVCNAME} "$satellite_log_file"
+}
diff --git a/testing/satellite/satellite.pre-install b/testing/satellite/satellite.pre-install
new file mode 100644
index 0000000000..1fd6912d5a
--- /dev/null
+++ b/testing/satellite/satellite.pre-install
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+addgroup -S satellite 2>/dev/null
+adduser -S -D -H -h /var/empty -s /sbin/nologin -G satellite -g satellite satellite 2>/dev/null
+
+exit 0
+
-- 
2.30.2