A sr.ht/legacy.sr.ht-shim/APKBUILD => sr.ht/legacy.sr.ht-shim/APKBUILD +37 -0
@@ 0,0 1,37 @@
+# Maintainer: Drew DeVault <sir@cmpwn.com>
+pkgname=legacy.sr.ht-shim
+pkgver=1.0.0
+pkgrel=0
+pkgdesc="legacy.sr.ht API shim service (you don't want to use this)"
+url="https://git.sr.ht/~sircmpwn/legacy.sr.ht-shim"
+arch="noarch"
+license="AGPLv3"
+depends="py3-srht"
+makedepends="py3-setuptools"
+subpackages="${pkgname}-openrc"
+source="
+ $pkgname-$pkgver.tar.gz::https://git.sr.ht/~sircmpwn/$pkgname/archive/$pkgver.tar.gz
+ legacy.sr.ht-shim.initd
+ legacy.sr.ht-shim.confd
+"
+builddir="$srcdir/$pkgname-$pkgver"
+export PKGVER=$pkgver
+options="$options !check"
+install="$pkgname.post-install"
+
+build() {
+ python3 setup.py build
+}
+
+package() {
+ python3 setup.py install --root="$pkgdir" --optimize=1
+ mkdir -p "$pkgdir"/etc/init.d
+ install -Dm755 "$srcdir"/legacy.sr.ht-shim.initd \
+ "$pkgdir"/etc/init.d/legacy.sr.ht-shim
+ install -Dm644 "$srcdir"/legacy.sr.ht-shim.confd \
+ "$pkgdir"/etc/conf.d/legacy.sr.ht-shim
+}
+
+sha512sums="4ffaaf522ef18f1fb82b0e3d2a54a6f594edbf6a2e55e9f58c41a36d858a431b617d7252792092ad1669b5df8aafd15c11129db3db84dda61f5d10158aa82f47 legacy.sr.ht-shim-1.0.0.tar.gz
+4eea9b305eef0149339aa8f89223bf78f9fae647f126258cb402e6e547b61e7c1e517de27431c49e839cd9e8c71c3ab6affd86d7f4f21791d8b10a51562753c6 legacy.sr.ht-shim.initd
+fc8dcf636fa146df3bc9eac72c9036f137b50cedacef39b31b5a9991ea8e646932c20ced8afa0cf1617ce9b4cda3fbac5538dd5a6e7bf20ced2890bda1ebd86f legacy.sr.ht-shim.confd"
A sr.ht/legacy.sr.ht-shim/legacy.sr.ht-shim.confd => sr.ht/legacy.sr.ht-shim/legacy.sr.ht-shim.confd +14 -0
@@ 0,0 1,14 @@
+# Run the daemon as this user:
+# LEGACYSHIM_USER=legacyshim
+
+# Bind the web service to this address:
+# LEGACYSHIM_BIND=127.0.0.1:5001
+
+# Extra arguments to pass to Gunicorn
+# LEGACYSHIM_ARGS=
+
+# If no, use an external postgresql server
+# LOCAL_PG=yes
+
+# If no, use an external redis server
+# LOCAL_REDIS=yes
A sr.ht/legacy.sr.ht-shim/legacy.sr.ht-shim.initd => sr.ht/legacy.sr.ht-shim/legacy.sr.ht-shim.initd +25 -0
@@ 0,0 1,25 @@
+#!/sbin/openrc-run
+name="legacy.sr.ht-shim"
+description="legacy.sr.ht shim API service"
+supervisor=supervise-daemon
+LEGACYSHIM_USER=${LEGACYSHIM_USER:-legacyshim}
+LEGACYSHIM_BIND=${LEGACYSHIM_BIND:-127.0.0.1:5001}
+LEGACYSHIM_ARGS=${LEGACYSHIM_ARGS:-}
+LOCAL_PG=${LOCAL_PG:-yes}
+LOCAL_REDIS=${LOCAL_REDIS:-yes}
+LOGS=/var/log/legacy.sr.ht-shim.log
+supervise_daemon_args="-1 $LOGS -2 $LOGS"
+command="/usr/bin/gunicorn"
+command_args="legacyshim.app:app -b $GIT_BIND $GIT_ARGS"
+command_user="$LEGACYSHIM_USER:$LEGACYSHIM_USER"
+pidfile="/run/${RC_SVCNAME}.pid"
+
+depend() {
+ need net
+ [ "$LOCAL_REDIS" = "yes" ] && need redis
+ [ "$LOCAL_PG" = "yes" ] && need postgresql
+}
+
+start_pre() {
+ checkpath -f "$LOGS" -m 644 -o "$LEGACYSHIM_USER:$LEGACYSHIM_USER"
+}
A sr.ht/legacy.sr.ht-shim/legacy.sr.ht-shim.post-install => sr.ht/legacy.sr.ht-shim/legacy.sr.ht-shim.post-install +3 -0
@@ 0,0 1,3 @@
+#!/bin/sh
+addgroup -S legacyshim || true
+adduser -SDH -s /sbin/nologin -g legacyshim legacyshim || true