blob: b93d15e433728cb71f9e2163e473d1f1cafa9184 (
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
#!/sbin/openrc-run
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License, v2 or later
# $Id$
depend() {
use vdr
}
start() {
ebegin "Starting vdradmin"
: ${VDRADMIN_USER:=vdradmin}
local dir vdradmin_opts
# Prepare directories
for dir in cache log run; do
checkpath -q -d -m 0755 -o ${VDRADMIN_USER}:vdradmin "/var/${dir}/vdradmin"
done
checkpath -q -d -m 0755 -o ${VDRADMIN_USER}:vdradmin "/etc/vdradmin" \
"/etc/vdradmin/certs"
checkpath -q -f -m 0644 -o ${VDRADMIN_USER}:vdradmin "/etc/vdradmin/vdradmind.conf" \
"/etc/vdradmin/certs/server-cert.pem" \
"/etc/vdradmin/certs/server-key.pem"
if [ "${SSL}" = "yes" ]; then vdradmin_opts="${vdradmin_opts} --ssl"; fi
if [ "${IPV6}" = "yes" ]; then vdradmin_opts="${vdradmin_opts} --ipv6"; fi
vdradmin_opts="${vdradmin_opts} --log ${LOGLEVEL:=4}"
if [ "${LOGGING}" = "syslog" ]; then
sed -i -e "/LOGGING/s-LOGGING.*-LOGGING = 1-" /etc/vdradmin/vdradmind.conf
sed -i -e "/LOGFILE/s-LOGFILE.*-LOGFILE = syslog-" /etc/vdradmin/vdradmind.conf
elif [ "${LOGGING}" = "file" ]; then
sed -i -e "/LOGGING/s-LOGGING.*-LOGGING = 1-" /etc/vdradmin/vdradmind.conf
sed -i -e "/LOGFILE/s-LOGFILE.*-LOGFILE = vdradmind.log-" /etc/vdradmin/vdradmind.conf
else
sed -i -e "/LOGGING/s-LOGGING.*-LOGGING = 0-" /etc/vdradmin/vdradmind.conf
fi
if [ -n "${RC_UNAME}" ]; then
# running on baselayout-2/openrc
start-stop-daemon --start --background --user "${VDRADMIN_USER}" \
--pidfile /var/run/vdradmin/vdradmind.pid \
--exec /usr/bin/perl /usr/bin/vdradmind -- ${vdradmin_opts}
else
start-stop-daemon --start --background --chuid "${VDRADMIN_USER}" \
--exec /usr/bin/vdradmind -- ${vdradmin_opts}
fi
eend $?
}
stop() {
ebegin "Stopping vdradmin"
start-stop-daemon --stop --quiet --pidfile /var/run/vdradmin/vdradmind.pid
eend $?
}
|