~dricottone/huttese-apk

81b94065f9ce8ee1561b185bbff3cb637da234c2 — Drew DeVault 6 years ago 1be721e
Add man.sr.ht package
A sr.ht/man.sr.ht/APKBUILD => sr.ht/man.sr.ht/APKBUILD +38 -0
@@ 0,0 1,38 @@
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=man.sr.ht
pkgver=0.5.0
pkgrel=0
pkgdesc="sr.ht wiki service"
url="https://git.sr.ht/~sircmpwn/man.sr.ht"
arch="noarch"
license="AGPLv3"
depends="
	py3-alembic
	py3-gunicorn
	py3-pygit2
	py3-srht
	redis
"
makedepends="py-setuptools nodejs sassc"
source="
	$pkgname-$pkgver.tar.gz::https://git.sr.ht/~sircmpwn/$pkgname/archive/$pkgver.tar.gz
	man.sr.ht.init
"
builddir="$srcdir/$pkgname-$pkgver"
export PKGVER=$pkgver
options="$options !check"
install="$pkgname.post-install $pkgname.post-upgrade"

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

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

sha512sums="65ba6ec47378ed521f6841fa0d5f0353368a81a61aa3ca12c4ac541bcbb99ce00ddda42a7d26466d9db479485c701e74763419deea0e644084c9990035d0b397  man.sr.ht-0.5.0.tar.xz
3da58e6cb93e24e7ce2ceea9f6a739476dbd6bf5b07e203ce5f8302475bd0ab2697f497989bc915bb377aa1e7e4362c2312ba5e13ce47d817b1bffdb621bf3a5  man.sr.ht.init"

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

# Override these with /etc/conf.d/man.sr.ht
MAN_USER=${MAN_USER:-man}
MAN_BIND=${MAN_BIND:-127.0.0.1:5000}
LOCAL_PG=${LOCAL_PG:-yes}
LOGS=/var/log/man.sr.ht.log

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

start() {
    if ! [ -e $LOGS ]
    then
        touch $LOGS
        chown $MAN_USER /var/log/man.sr.ht.log
    fi
	ebegin "Starting $name"
	start-stop-daemon \
		-u ${MAN_USER} \
		-1 "$LOGS" \
		-2 "$LOGS" \
		--background \
		--make-pidfile \
		--pidfile /run/$name.pid \
		--exec /usr/bin/gunicorn -- \
			mansrht.app:app_dispatch -b ${MAN_BIND}
	eend $?
}

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

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

A sr.ht/man.sr.ht/man.sr.ht.post-upgrade => sr.ht/man.sr.ht/man.sr.ht.post-upgrade +6 -0
@@ 0,0 1,6 @@
#!/bin/sh
conf=/etc/sr.ht/alembic/man.ini
if [ -e "$conf" ]
then
	alembic-3 -c "$conf" upgrade head
fi