#!/bin/sh
#
# Set some audio parameters at boot time.
#
# This file is part of sparc-utils package.
#
# Written by Eric Delaunay <delaunay@debian.org> based on example
# from Adam Di Carlo <aph@debian.org>.
#
# Licensed under GPL.

test -x /usr/bin/audioctl || exit 0

setaudio () {
	if [ -n "$DEVICE" ]; then
	    optdev="-f $DEVICE"
	fi
	/usr/bin/audioctl -nw $optdev $PARAMS
}

# Source defaults file
PARAMS=
DEVICE=
if [ -f /etc/default/audioctl ]; then
	. /etc/default/audioctl
fi

case "$1" in
start)
	echo -n "Setting audio parameters..."
	if [ -n "$PARAMS" ]; then
		setaudio
		echo "done."
	else
		echo "none."
	fi
	;;
stop)
	;;
reload|reload|force-reload)
	$0 start
	;;
restart)
	$0 stop
	$0 start
	;;
*)
	echo "Usage: $0 {start|stop|restart|reload|force-reload}"
	exit 1
	;;
esac

exit 0
