#!/bin/sh /etc/rc.common
|
|
|
|
START=82
|
|
|
|
USE_PROCD=1
|
|
PROG=/usr/bin/gerbera
|
|
|
|
start_service() {
|
|
local enabled
|
|
local debug
|
|
local home
|
|
|
|
config_load 'gerbera'
|
|
config_get_bool enabled config 'enabled' '0'
|
|
config_get_bool debug config 'debug' '0'
|
|
|
|
[ "$enabled" -eq 0 ] && {
|
|
echo "Gerbera not enabled. Please enable in /etc/config/gerbera"
|
|
return 1
|
|
}
|
|
|
|
config_get home config 'home' '/tmp/gerbera'
|
|
|
|
[ -d "$home" ] || {
|
|
mkdir -p "$home"
|
|
chown gerbera:gerbera "$home"
|
|
|
|
gerbera -m "$home" -f '' --create-config > "$home/config.xml" 2> /dev/null
|
|
echo "Created default gerbera config at $home/config.xml"
|
|
echo "Please edit to your liking and restart."
|
|
return 2
|
|
}
|
|
|
|
procd_open_instance
|
|
procd_set_param user gerbera
|
|
procd_set_param group gerbera
|
|
procd_set_param command "$PROG" -c "$home/config.xml"
|
|
procd_set_param stdout "$debug"
|
|
procd_set_param stderr 1
|
|
procd_close_instance
|
|
}
|