#!/sbin/runscript
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

NAME="shairport"
DAEMON="/usr/bin/shairport.pl"
DAEMON_ARGS=""
PIDFILE="/var/run/${NAME}.pid"


depend() {
    need net
    use avahi-daemon
}

start() {
    ebegin "Starting shairport"
    start-stop-daemon --start --quiet --pidfile "$PIDFILE" \
	  --user audio --exec "$DAEMON" -b --oknodo -- $DAEMON_ARGS
    eend $*
}

stop() {
    ebegin "Shutting down shairport"
    start-stop-daemon --stop --quiet --pidfile "$PIDFILE" \
	  --retry 1 --oknodo
    eend $*
}