summaryrefslogtreecommitdiff
blob: b55454cdda5cb94fa0227aa56044571f272cedb6 (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
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2         
# $Header: /var/cvsroot/gentoo-x86/media-sound/daapd/files/daapd.init.d-2,v 1.1 2005/10/17 11:44:35 flameeyes Exp $

depend() {
	need net
	#WITHHOWL need mDNSResponder
}

checkconfig() {
	if grep -E '^Root\w+\.$' /etc/daapd.conf &>/dev/null; then
		ewarn "The Root in /etc/daapd.conf has not been updated. You probably"
		ewarn "want to point this to your music archive instead of $(pwd)"
	fi
}

start() {
	ebegin "Starting daapd"
	checkconfig

	local SSD_OPTS
	SSD_OPTS=""
	[[ -n ${DAAPD_RUNAS} ]] && SSD_OPTS="${SSD_OPTS} --chuid '${DAAPD_RUNAS}'"

	start-stop-daemon --start --quiet --pidfile /var/run/daapd.pid \
		--background --make-pidfile \
		${SSD_OPTS} --exec /usr/bin/daapd -- ${DAAPD_OPTS}
	eend $? "Failed to start daapd"
}

stop() {
	ebegin "Stopping daapd"
	start-stop-daemon --stop --quiet --pidfile /var/run/daapd.pid
	eend $? "Failed to stop daapd"

	# clean stale pidfile
	rm -f /var/run/daapd.pid
}