aboutsummaryrefslogtreecommitdiffstats
path: root/community/gerbera/gerbera.initd
blob: 34bf6e4645315cbda23a77067eb718837b6b4172 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/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%/*}
}