summaryrefslogtreecommitdiff
blob: 43ef2b199934fefa6439ff3b14646119d58d2ee1 (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
#!/sbin/runscript
# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License, v2 or later
# $Header: /var/cvsroot/gentoo-x86/www-misc/vdradmin-am/files/vdradmin-4,v 1.1 2009/04/11 23:23:28 hd_brummy Exp $

depend() {
	use vdr
}

set_charset() {
	local capfile=/usr/share/vdr/capabilities.sh
	[ -e "${capfile}" ] && . ${capfile}
	if [ "${CAP_UTF8}" = "1" -o "${VDR_CAN_HANDLE_UTF8}" = "yes" ]; then
		# do not clean out utf8
		:
	else
		l=$(locale | sed -e 's/\.[uU][tT][fF]\(-\)\?8//' -e 's/^/export /')
		eval $l
	fi
}

start() {
	ebegin "Starting vdradmin-am"

	: ${VDRADMIN_USER:=vdradmin}

	# Guarantee that vdradmin can access its tmp-dir
	chown -R "${VDRADMIN_USER}:vdradmin" /var/tmp/vdradmin

	set_charset
	if [ -x /etc/init.d/root ]; then
		# running on baselayout-2/openrc
		start-stop-daemon --start --background --chuid "${VDRADMIN_USER}" --pidfile /var/tmp/vdradmin/vdradmind.pid \
		--exec /usr/bin/perl /usr/bin/vdradmind
	else
		start-stop-daemon --start --background --chuid "${VDRADMIN_USER}" --exec /usr/bin/vdradmind
	fi
	eend $?
}

stop() {
	ebegin "Stopping vdradmin-am"
	start-stop-daemon --stop --quiet --pidfile /var/tmp/vdradmin/vdradmind.pid
	eend $?
}