~sircmpwn/sr.ht-packages

sr.ht-apkbuilds: api.sr.ht: new aport v1 PROPOSED

Adnan Maolood: 1
 api.sr.ht: new aport

 4 files changed, 61 insertions(+), 0 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~sircmpwn/sr.ht-packages/patches/33635/mbox | git am -3
Learn more about email & git

[PATCH sr.ht-apkbuilds] api.sr.ht: new aport Export this patch

---
 sr.ht/api.sr.ht/APKBUILD               | 38 ++++++++++++++++++++++++++
 sr.ht/api.sr.ht/api.sr.ht.confd        |  2 ++
 sr.ht/api.sr.ht/api.sr.ht.initd        | 18 ++++++++++++
 sr.ht/api.sr.ht/api.sr.ht.post-install |  3 ++
 4 files changed, 61 insertions(+)
 create mode 100644 sr.ht/api.sr.ht/APKBUILD
 create mode 100644 sr.ht/api.sr.ht/api.sr.ht.confd
 create mode 100755 sr.ht/api.sr.ht/api.sr.ht.initd
 create mode 100644 sr.ht/api.sr.ht/api.sr.ht.post-install

diff --git a/sr.ht/api.sr.ht/APKBUILD b/sr.ht/api.sr.ht/APKBUILD
new file mode 100644
index 0000000..223c024
--- /dev/null
+++ b/sr.ht/api.sr.ht/APKBUILD
@@ -0,0 +1,38 @@
# Maintainer: Adnan Maolood <me@adnano.co>
pkgname=api.sr.ht
pkgver=0_git20220707
_commit=67eba39787102813b53480350430fb33df210fe0
pkgrel=0
pkgdesc="SourceHut GraphQL API gateway"
url="https://git.sr.ht/~sircmpwn/api.sr.ht"
arch="all"
license="AGPLv3"
makedepends="go"
subpackages="$pkgname-openrc"
source="
	$pkgname-$_commit.tar.gz::https://git.sr.ht/~sircmpwn/$pkgname/archive/$_commit.tar.gz
	api.sr.ht.initd
	api.sr.ht.confd
"
export PKGVER=$pkgver
options="$options !check"
install="$pkgname.post-install"
builddir="$srcdir/$pkgname-$_commit"

build() {
	make all
}

package() {
	install -Dm755 api.sr.ht "$pkgdir"/usr/bin/api.sr.ht
	install -Dm755 "$srcdir"/api.sr.ht.initd \
		"$pkgdir"/etc/init.d/api.sr.ht
	install -Dm644 "$srcdir"/api.sr.ht.confd \
		"$pkgdir"/etc/conf.d/api.sr.ht
}

sha512sums="
12ce52af6d9c2fd91ead16c2f34f8f23319d985774dcd6fbafab5fab6be15f1f3ab8b159c09eb3b4faa760b35aadb96b9e6985bb3a94ac851419d2b33bc347cd  api.sr.ht-67eba39787102813b53480350430fb33df210fe0.tar.gz
dd1bc4642241ac18433d9bdca0901717c5c4d375539c5508b34614b91f7a422f8708ad37351ae0222da606e113da7c10b6300d97cac87be833d3c13dfe15f294  api.sr.ht.initd
69a5d0a0802b2e0cd39c453195b0d5b43b11889b38485e7b5ff770b30b13b856af7b5cefabf812a18aa8da11f55fb6b1e54a4a4795b50ce2fc65733f1666cc64  api.sr.ht.confd
"
diff --git a/sr.ht/api.sr.ht/api.sr.ht.confd b/sr.ht/api.sr.ht/api.sr.ht.confd
new file mode 100644
index 0000000..45bf9ec
--- /dev/null
+++ b/sr.ht/api.sr.ht/api.sr.ht.confd
@@ -0,0 +1,2 @@
# Run the daemon as this user:
# API_USER=api
diff --git a/sr.ht/api.sr.ht/api.sr.ht.initd b/sr.ht/api.sr.ht/api.sr.ht.initd
new file mode 100755
index 0000000..ce452c7
--- /dev/null
+++ b/sr.ht/api.sr.ht/api.sr.ht.initd
@@ -0,0 +1,18 @@
#!/sbin/openrc-run
name="api.sr.ht"
description="api.sr.ht service"
supervisor=supervise-daemon
API_USER=${API_USER:-api}
LOGS=/var/log/api.sr.ht.log
supervise_daemon_args="-1 $LOGS -2 $LOGS"
command="/usr/bin/api.sr.ht"
command_user="$API_USER:$API_USER"
pidfile="/run/${RC_SVCNAME}.pid"

depend() {
	need net
}

start_pre() {
	checkpath -f "$LOGS" -m 644 -o "$API_USER:$API_USER"
}
diff --git a/sr.ht/api.sr.ht/api.sr.ht.post-install b/sr.ht/api.sr.ht/api.sr.ht.post-install
new file mode 100644
index 0000000..0cd34b1
--- /dev/null
+++ b/sr.ht/api.sr.ht/api.sr.ht.post-install
@@ -0,0 +1,3 @@
#!/bin/sh
addgroup -S api || true
adduser -SDH -s /sbin/nologin -G api -g api api || true
-- 
2.37.0