~dricottone/huttese-apk

d551c20c3f04c66bce168bfe53998a017e75522a — Drew DeVault 5 years ago 12d1e40
man.sr.ht: normalize init scripts
3 files changed, 32 insertions(+), 27 deletions(-)

M sr.ht/man.sr.ht/APKBUILD
A sr.ht/man.sr.ht/man.sr.ht.confd
R sr.ht/man.sr.ht/{man.sr.ht.init => man.sr.ht.initd}
M sr.ht/man.sr.ht/APKBUILD => sr.ht/man.sr.ht/APKBUILD +10 -5
@@ 1,6 1,6 @@
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=man.sr.ht
pkgver=0.5.0
pkgver=0.9.1
pkgrel=0
pkgdesc="sr.ht wiki service"
url="https://git.sr.ht/~sircmpwn/man.sr.ht"


@@ 17,7 17,8 @@ makedepends="py-setuptools nodejs sassc"
subpackages="${pkgname}-openrc"
source="
	$pkgname-$pkgver.tar.gz::https://git.sr.ht/~sircmpwn/$pkgname/archive/$pkgver.tar.gz
	man.sr.ht.init
	man.sr.ht.initd
	man.sr.ht.confd
"
builddir="$srcdir/$pkgname-$pkgver"
export PKGVER=$pkgver


@@ 32,8 33,12 @@ 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
	install -Dm755 "$srcdir"/man.sr.ht.initd \
		"$pkgdir"/etc/init.d/man.sr.ht
	install -Dm644 "$srcdir"/man.sr.ht.confd \
		"$pkgdir"/etc/conf.d/man.sr.ht
}

sha512sums="65ba6ec47378ed521f6841fa0d5f0353368a81a61aa3ca12c4ac541bcbb99ce00ddda42a7d26466d9db479485c701e74763419deea0e644084c9990035d0b397  man.sr.ht-0.5.0.tar.xz
0b897087e3b1fd11093beef47f7c976e423e860da360549f11095f5c9dcf3de4e899082156d88f305e64670508e7f9e6a2919b404ede800c624dd89a8226ae63  man.sr.ht.init"
sha512sums="73ebf55b42ab5ce0e4dff3e73f1d858b2b2829f52e78c36b19418c12cd235c83b2c33594571c9aa53d9e6b0201f37c3e07832cffc5b700640bf3f75c4b9909ac  man.sr.ht-0.9.1.tar.gz
fe5ad8aee48f0394caf3f77bf79b0356b1b29b18d00a981fef97a3913f1956f8e31cf18b3b0e8c98c04307e053e2bdaed5b48946f97199b2ced0e7815c8e47d9  man.sr.ht.initd
6f12f67a857b2839ea590ba27e165bb5b436ce3dc4ee8ae5a67edc83ba4b9175bcc192c7c36e55c68449e4b07cc92444f0a6ce586cad55934f6e4bceee0b7c17  man.sr.ht.confd"

A sr.ht/man.sr.ht/man.sr.ht.confd => sr.ht/man.sr.ht/man.sr.ht.confd +14 -0
@@ 0,0 1,14 @@
# Run the daemon as this user:
# MAN_USER=man

# Bind the web service to this address:
# MAN_BIND=127.0.0.1:5004

# Extra arguments to pass to Gunicorn
# MAN_ARGS=

# If no, use an external postgresql server
# LOCAL_PG=yes

# If no, use an external redis server
# LOCAL_REDIS=yes

R sr.ht/man.sr.ht/man.sr.ht.init => sr.ht/man.sr.ht/man.sr.ht.initd +8 -22
@@ 1,14 1,18 @@
#!/sbin/openrc-run
name="man.sr.ht"
description="man.sr.ht service"

# Override these with /etc/conf.d/man.sr.ht
supervisor=supervise-daemon
MAN_USER=${MAN_USER:-man}
MAN_BIND=${MAN_BIND:-127.0.0.1:5004}
MAN_ARGS=${MAN_ARGS:-}
LOCAL_PG=${LOCAL_PG:-yes}
LOCAL_REDIS=${LOCAL_REDIS:-yes}
LOGS=/var/log/man.sr.ht.log
supervise_daemon_args="-1 $LOGS -2 $LOGS"
command="/usr/bin/gunicorn"
command_args="mansrht.app:app -b $MAN_BIND $MAN_ARGS"
command_user="$MAN_USER:$MAN_USER"
pidfile="/run/${RC_SVCNAME}.pid"

depend() {
	need net


@@ 16,24 20,6 @@ depend() {
	[ "$LOCAL_PG" = "yes" ] && need postgresql
}

start() {
	touch "$LOGS"
	chown $MAN_USER "$LOGS"
	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 -b ${MAN_BIND} ${MAN_ARGS}
	eend $?
}

stop() {
	ebegin "Stopping $name"
	start-stop-daemon --stop --exec /usr/bin/gunicorn --pidfile /run/$name.pid
	eend $?
start_pre() {
	checkpath -f "$LOGS" -m 644 -o "$MAN_USER:$MAN_USER"
}