~krystianch/apkbuilds

ff682fd82b7d00d5481486acaf68cab8f0619033 — Krystian Chachuła 6 months ago ea48ba6
krystianch/photobrowser: add config checking
M krystianch/photobrowser/APKBUILD => krystianch/photobrowser/APKBUILD +4 -4
@@ 1,7 1,7 @@
# Maintainer: Krystian Chachuła <krystian@krystianch.com>
pkgname=photobrowser
pkgver=0.1.4
pkgrel=0
pkgrel=1
pkgdesc="Web photo and video browser"
url="https://sr.ht/~krystianch/photobrowser/"
arch="noarch"


@@ 55,11 55,11 @@ package() {
}

sha512sums="
cf41b80b5e140cadb47f6727d2eb223ac75d78c216b209248af28dbd8f089e7ca62d2ed8e136b6fc2d58cb281d05902a6752b40dcb92aba7b4a9619aba5d8cf0  photobrowser.initd
de29fb838306e3b5801df3e81a76ee67d1bf4fc98151b0a890dee532c47b1cf8ab4428756587fece772e9bf2f45a1527a16a52118474cd9d8ac92a2df30caca2  photobrowser.initd
711655c974ae9774a1b6adc83ba93556753db9d3384cca67bd9e06c9276aa0d2f24d248b1aad68c5b61520a2df9b88e1617a626b4381d0378982b8df30c319a7  photobrowser.confd
6133390ba0f2e5217f02c3be045400d6145172277516ac0700c455d553e0c40c730f8424fb3849f9f07ec26061bc1d490eaad0152c69c44e5a38a31eea8396be  photobrowser-thumbs.initd
85354587fdc0ca0410e55c47466bc0d5393f857ed756084600160428935fe4856ab731e2aa581d51f1f0792e9f9f8e960f0d75d8cde29309383ce677ad7d7981  photobrowser-thumbs.initd
f54d7acbf77987f0b4a6e9bc4d4c89e604e280986362a2887c97921b4082174ba9c5d0585592dc8d182f50a03aa15c459adf4feea0dd25c45fecde5b204f4c07  photobrowser-thumbs.confd
cc88bcf4973ea2c7476730e67ffd15ae4e1b7a56c4d5201eed94cd493e05452f21c589333cd41ad19e9b26e76a851370766e68d377e62adf30b4dec0a28df581  photobrowser-clips.initd
171eedb7a2d8d7afcaa1c6dc8d5742b53790ed6d5906d781e49e40fa99de3761be72a710dd0f31446feb535b7703d337afeda52e1879411524a705c80564f5e4  photobrowser-clips.initd
dd9822de89cb800a89b3098623a72bde96c4983ef06863f853ffa52b06e4115f5c5a97446fd10d6907fdec77b18509d79a42aad54e6a7468679c8ca48297a994  photobrowser-clips.confd
121f48cc78ce12fbdffa0b62921f563294a4a21ba413e5d4466b63aaccff96fdc3413430cf28dc9bfe35958ac6f2301b26fa2891804eb8551b97bac96bb81ff0  photobrowser-0.1.4.tar.gz
"

A krystianch/photobrowser/photobrowser-clips.confd => krystianch/photobrowser/photobrowser-clips.confd +14 -0
@@ 0,0 1,14 @@
# Configuration for /etc/init.d/photobrowser-clips

_suffix=${RC_SVCNAME#photobrowser-clips.}

export PHOTOBROWSER_LOG_LEVEL=INFO

command_user="$_suffix:$_suffix"
command_args="--workers 1"

# Comment out to disable process supervisor.
supervisor=supervise-daemon

output_log="/var/log/photobrowser/$_suffix-clips.log"
error_log="/var/log/photobrowser/$_suffix-clips.log"

A krystianch/photobrowser/photobrowser-clips.initd => krystianch/photobrowser/photobrowser-clips.initd +41 -0
@@ 0,0 1,41 @@
#!/sbin/openrc-run

name="photobrowser-clips"
description="Web photo and video browser (proxy clip generator)"

: ${command_user:="photobrowser:photobrowser"}

command="/usr/bin/flask"
command_args="--app photobrowser clips --watch $command_args"
command_background="yes"
pidfile="/run/$RC_SVCNAME.pid"

depend() {
	need net
	after firewall
}

checkconfig() {
	doas -u "${command_user%%:*}" flask --app photobrowser check
}

start_pre() {
	if [ -n "$output_log" ]; then
		output_log_path=$(dirname "$output_log")
		checkpath -d -o "$command_user" "$output_log_path"
	fi
	if [ -n "$error_log" ]; then
		error_log_path=$(dirname "$error_log")
		checkpath -d -o "$command_user" "$error_log_path"
	fi

	if [ "${RC_CMD}" != "restart" ] ; then
		checkconfig || return $?
	fi
}

stop_pre() {
	if [ "${RC_CMD}" = "restart" ] ; then
		checkconfig || return $?
	fi
}

A krystianch/photobrowser/photobrowser-thumbs.confd => krystianch/photobrowser/photobrowser-thumbs.confd +14 -0
@@ 0,0 1,14 @@
# Configuration for /etc/init.d/photobrowser-thumbs

_suffix=${RC_SVCNAME#photobrowser-thumbs.}

export PHOTOBROWSER_LOG_LEVEL=INFO

command_user="$_suffix:$_suffix"
command_args="--workers 1"

# Comment out to disable process supervisor.
supervisor=supervise-daemon

output_log="/var/log/photobrowser/$_suffix-thumbs.log"
error_log="/var/log/photobrowser/$_suffix-thumbs.log"

A krystianch/photobrowser/photobrowser-thumbs.initd => krystianch/photobrowser/photobrowser-thumbs.initd +41 -0
@@ 0,0 1,41 @@
#!/sbin/openrc-run

name="photobrowser-thumbs"
description="Web photo and video browser (thumbnail generator)"

: ${command_user:="photobrowser:photobrowser"}

command="/usr/bin/flask"
command_args="--app photobrowser thumbs --watch $command_args"
command_background="yes"
pidfile="/run/$RC_SVCNAME.pid"

depend() {
	need net
	after firewall
}

checkconfig() {
	doas -u "${command_user%%:*}" flask --app photobrowser check
}

start_pre() {
	if [ -n "$output_log" ]; then
		output_log_path=$(dirname "$output_log")
		checkpath -d -o "$command_user" "$output_log_path"
	fi
	if [ -n "$error_log" ]; then
		error_log_path=$(dirname "$error_log")
		checkpath -d -o "$command_user" "$error_log_path"
	fi

	if [ "${RC_CMD}" != "restart" ] ; then
		checkconfig || return $?
	fi
}

stop_pre() {
	if [ "${RC_CMD}" = "restart" ] ; then
		checkconfig || return $?
	fi
}

A krystianch/photobrowser/photobrowser.confd => krystianch/photobrowser/photobrowser.confd +15 -0
@@ 0,0 1,15 @@
# Configuration for /etc/init.d/photobrowser

_suffix=${RC_SVCNAME#photobrowser.}

PHOTOBROWSER_SOCKET="/run/photobrowser/$_suffix.sock"
export PHOTOBROWSER_LOG_LEVEL=INFO

command_user="$_suffix:$_suffix"
command_args="-b unix:$PHOTOBROWSER_SOCKET"

# Comment out to disable process supervisor.
supervisor=supervise-daemon

output_log="/var/log/photobrowser/$_suffix.log"
error_log="/var/log/photobrowser/$_suffix.log"

A krystianch/photobrowser/photobrowser.initd => krystianch/photobrowser/photobrowser.initd +46 -0
@@ 0,0 1,46 @@
#!/sbin/openrc-run

name="photobrowser"
description="Web photo and video browser"

: ${command_user:="photobrowser:photobrowser"}

command="/usr/bin/gunicorn"
command_args="$command_args 'photobrowser:create_app()'"
command_background="yes"
pidfile="/run/$RC_SVCNAME.pid"

depend() {
	need net
	after firewall
}

checkconfig() {
	doas -u "${command_user%%:*}" flask --app photobrowser check
}

start_pre() {
	if [ -n "$PHOTOBROWSER_SOCKET" ]; then
		socket_path=$(dirname "$PHOTOBROWSER_SOCKET")
		checkpath -d -m 775 -o "photobrowser:photobrowser" "$socket_path"
	fi

	if [ -n "$output_log" ]; then
		output_log_path=$(dirname "$output_log")
		checkpath -d -o "$command_user" "$output_log_path"
	fi
	if [ -n "$error_log" ]; then
		error_log_path=$(dirname "$error_log")
		checkpath -d -o "$command_user" "$error_log_path"
	fi

	if [ "${RC_CMD}" != "restart" ] ; then
		checkconfig || return $?
	fi
}

stop_pre() {
	if [ "${RC_CMD}" = "restart" ] ; then
		checkconfig || return $?
	fi
}

A krystianch/photobrowser/photobrowser.pre-install => krystianch/photobrowser/photobrowser.pre-install +6 -0
@@ 0,0 1,6 @@
#!/bin/sh

addgroup -S photobrowser 2>/dev/null
adduser -S -D -H -h /var/lib/photobrowser -s /sbin/nologin -G photobrowser -g photobrowser photobrowser 2>/dev/null

exit 0