#! /bin/sh
# /etc/init.d/nas: start or stop the Network Audio System.

# Remove this if you do not want the nas daemon to relinquish the
# audio device when not in use
NAS_DEVICE_POLICY=relinquish
export NAS_DEVICE_POLICY

# The nas daemon by default will change the mixer settings at
# startup. This definition will stop it doing so.
NAS_MIXER_POLICY=leave
export NAS_MIXER_POLICY

test -f /usr/bin/auvoxware || exit 0

case "$1" in
  start)
    echo Starting the Network Audio System
    start-stop-daemon --start --quiet --startas /usr/bin/start-nas \
						--exec /usr/bin/au
    ;;
  stop)
    echo Stopping the Network Audio System
    start-stop-daemon --stop --quiet --exec /usr/bin/au
    ;;
  restart|force-reload)
    echo Restarting the Network Audio System
    start-stop-daemon --stop --quiet --exec /usr/bin/au
    start-stop-daemon --start --quiet --startas /usr/bin/start-nas \
						--exec /usr/bin/au
    ;;
  *)
    echo "Usage: /etc/init.d/nas {start|stop|restart|force-reload}"
    exit 1
esac

exit 0
