aboutsummaryrefslogtreecommitdiffstats
path: root/testing/gerbera/gerbera.initd
blob: 8356a0a2122f6726c7f2e4c04904b9f0cf8ae446 (plain)
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 ${j_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%/*}
}