~dricottone/huttese-apk

c22847d0fa379dbc0c5315c487f98981f2395851 — Drew DeVault 5 years ago 56b2123
Add paste.sr.ht package
A sr.ht/paste.sr.ht/APKBUILD => sr.ht/paste.sr.ht/APKBUILD +36 -0
@@ 0,0 1,36 @@
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=paste.sr.ht
pkgver=0.1.1
pkgrel=0
pkgdesc="sr.ht paste service"
url="https://git.sr.ht/~sircmpwn/paste.sr.ht"
arch="noarch"
license="AGPLv3"
depends="
	py3-gunicorn
	py3-srht
"
makedepends="py-setuptools nodejs sassc"
subpackages="${pkgname}-openrc"
source="
	$pkgname-$pkgver.tar.gz::https://git.sr.ht/~sircmpwn/$pkgname/archive/$pkgver.tar.gz
	paste.sr.ht.init
"
builddir="$srcdir/$pkgname-$pkgver"
export PKGVER=$pkgver
options="$options !check"
install="$pkgname.post-install"

build() {
	cd "$builddir"
	python3 setup.py build
}

package() {
	cd "$builddir"
	python3 setup.py install --root="$pkgdir" --optimize=1
	install -Dm755 "$srcdir"/paste.sr.ht.init "$pkgdir"/etc/init.d/paste.sr.ht
}

sha512sums="fdd7826c281e799c1e659821aeedb0837863af7188c532ff870a854a96ede1945aae62b4635687fb3f041f33850e9b87423a077ef33720ef3aae9c82516cc854  paste.sr.ht-0.1.1.tar.gz
36c2280f76af770ac963916fadcdb9a01976ceb0215f324f14fc56207bf5d07305059b7a6ff07c16886f9139591a36399f5bebb1670ffe719519a30c1c9e5177  paste.sr.ht.init"

A sr.ht/paste.sr.ht/paste.sr.ht.init => sr.ht/paste.sr.ht/paste.sr.ht.init +39 -0
@@ 0,0 1,39 @@
#!/sbin/openrc-run
name="paste.sr.ht"
description="paste.sr.ht service"

# Override these with /etc/conf.d/paste.sr.ht
PASTE_USER=${PASTE_USER:-paste}
PASTE_BIND=${PASTE_BIND:-127.0.0.1:5011}
PASTE_ARGS=${PASTE_ARGS:-}
LOCAL_PG=${LOCAL_PG:-yes}
LOCAL_REDIS=${LOCAL_REDIS:-yes}
LOGS=/var/log/paste.sr.ht.log

depend() {
	need net
	[ "$LOCAL_REDIS" = "yes" ] && need redis
	[ "$LOCAL_PG" = "yes" ] && need postgresql
}

start() {
	ebegin "Starting $name"
	touch "$LOGS"
	chown $PASTE_USER "$LOGS"
	start-stop-daemon \
		-u $PASTE_USER \
		-1 "$LOGS" \
		-2 "$LOGS" \
		--background \
		--make-pidfile \
		--pidfile /run/$name.pid \
		--exec /usr/bin/gunicorn -- \
			pastesrht.app:app -b ${PASTE_BIND} ${PASTE_ARGS}
	eend $?
}

stop() {
	ebegin "Stopping $name"
	start-stop-daemon --stop --exec /usr/bin/gunicorn --pidfile /run/$name.pid
	eend $?
}

A sr.ht/paste.sr.ht/paste.sr.ht.post-install => sr.ht/paste.sr.ht/paste.sr.ht.post-install +3 -0
@@ 0,0 1,3 @@
#!/bin/sh
addgroup -S paste || true
adduser -SDH -s /sbin/nologin -g paste paste || true