~dricottone/huttese-apk

ec4d2192d0cf8f4ab9a0badc80263430e59a5dc2 — Drew DeVault 5 years ago 88af810
paste.sr.ht: normalize init scripts
3 files changed, 32 insertions(+), 27 deletions(-)

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


@@ 14,7 14,8 @@ 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
	paste.sr.ht.initd
	paste.sr.ht.confd
"
builddir="$srcdir/$pkgname-$pkgver"
export PKGVER=$pkgver


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

sha512sums="fdd7826c281e799c1e659821aeedb0837863af7188c532ff870a854a96ede1945aae62b4635687fb3f041f33850e9b87423a077ef33720ef3aae9c82516cc854  paste.sr.ht-0.1.1.tar.gz
36c2280f76af770ac963916fadcdb9a01976ceb0215f324f14fc56207bf5d07305059b7a6ff07c16886f9139591a36399f5bebb1670ffe719519a30c1c9e5177  paste.sr.ht.init"
sha512sums="b5048000384533ea919a75985c81c6c4244fbb025b00f96523e54ab71a470d1c109e7d120e9e2214edd196d6b1f3b319f3974b58b734c61eb175727e5bf04662  paste.sr.ht-0.3.2.tar.gz
d212f4e96a15b7db6f676a57ae9f8956456d3ec7d61e8cc2cfdcca30890cceaf1f38f87772f97143620ef9ec749fa54c3e0e1029e2a74b9dba95f1a571e0658b  paste.sr.ht.initd
5ad67f8d07683186fd8b25e4075f6b83754bfd1a6072a494641601a73941b32be018335539cf34d15eee2200f7067fb4cf6f0a064cadc34d0c0b834b1a938d70  paste.sr.ht.confd"

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

# Bind the web service to this address:
# PASTE_BIND=127.0.0.1:5000

# Extra arguments to pass to Gunicorn
# PASTE_ARGS=

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

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

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

# Override these with /etc/conf.d/paste.sr.ht
supervisor=supervise-daemon
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
supervise_daemon_args="-1 $LOGS -2 $LOGS"
command="/usr/bin/gunicorn"
command_args="pastesrht.app:app -b $PASTE_BIND $PASTE_ARGS"
command_user="$PASTE_USER:$PASTE_USER"
pidfile="/run/${RC_SVCNAME}.pid"

depend() {
	need net


@@ 16,24 20,6 @@ depend() {
	[ "$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 $?
start_pre() {
	checkpath -f "$LOGS" -m 644 -o "$PASTE_USER:$PASTE_USER"
}