#!/bin/sh
#
# $NetBSD: gerbera.sh,v 1.1 2022/02/08 06:26:49 khorben Exp $
#

# PROVIDE: gerbera
# REQUIRE: DAEMON

$_rc_subr_loaded . /etc/rc.subr

name="gerbera"
rcvar=$name
load_rc_config_var gerbera_username gerbera_username
load_rc_config_var gerbera_groupname gerbera_groupname
command="/usr/pkg/bin/gerbera"
logfile="/var/log/${name}.log"
pidfile="/var/gerbera/${name}.pid"
command_args="-u ${gerbera_username:-gerbera} -g ${gerbera_groupname:-gerbera} -m /var/gerbera -P ${pidfile} -l ${logfile} -c /usr/pkg/etc/gerbera/config.xml"

if [ -f /etc/rc.subr ]; then
	load_rc_config $name
	run_rc_command "$1"
else
	echo -n "${name}"
	${command} ${gerbera_flags} ${command_args}
fi
