aboutsummaryrefslogblamecommitdiffstats
path: root/community/gerbera/gerbera.initd
blob: 34bf6e4645315cbda23a77067eb718837b6b4172 (plain) (tree)
1
2
3
4
5



                                               
                                                                              




























                                                                   
#!/sbin/openrc-run

name="Gerbera"
configfile="${CONFIG:-/etc/gerbera/config.xml}"
start_stop_daemon_args="--user ${G_USER:-gerbera} --group ${G_GROUP:-gerbera}"
pidfile="/run/gerbera/gerbera.pid"
command=/usr/bin/gerbera
command_args="-c $configfile -l /var/log/gerbera/gerbera.log"
command_background=true

depend() {
	need net
}

start_pre() {
	if ! [ -f "${configfile}" ]; then
		/usr/sbin/gerbera --create-config > "${configfile}"
	fi
	if yesno "${DEBUG}"; then
		command_args="$command_args -D"
	fi
	if [ ! -z "${BIND_INTERFACE}" ]; then
		command_args="$command_args -e ${BIND_INTERFACE}"
	fi
	if [ ! -z "${BIND_PORT}" ]; then
		command_args="$command_args -p ${BIND_PORT}"
	fi
	if [ ! -z "${BIND_IP}" ]; then
		command_args="$command_args -i ${BIND_IP}"
	fi
	
	checkpath --owner ${G_USER:-gerbera}:${G_GROUP:-gerbera} \
		--directory ${pidfile%/*}
}