#!/sbin/openrc-run
# Copyright 2022 Hyperbola Project
# Distributed under the terms of the GNU General Public License v2

export LAMINAR_HOME=${LAMINAR_HOME}
export LAMINAR_BIND_HTTP=${LAMINAR_BIND_HTTP}
export LAMINAR_BIND_RPC=${LAMINAR_BIND_RPC}
export LAMINAR_TITLE=${LAMINAR_TITLE}
export LAMINAR_KEEP_RUNDIRS=${LAMINAR_KEEP_RUNDIRS}
export LAMINAR_BASE_URL=${LAMINAR_BASE_URL}
export LAMINAR_ARCHIVE_URL=${LAMINAR_ARCHIVE_URL}

depend() {
	need net localmount
}

start() {
	ebegin "Starting Laminar Continuous Integration Server"
	start-stop-daemon --start --background --chdir /var/lib/laminar \
	--make-pidfile --pidfile /run/laminard.pid \
	--exec /usr/sbin/laminard --
	eend $?
}

stop() {
	ebegin "Stopping Laminar Continuous Integration Server"
	start-stop-daemon --stop --quiet --pidfile /run/laminard.pid
	eend $?
}
