#!/bin/bash

. /etc/colorrc

test -f /usr/sbin/alsactl || exit 0

Retstat=$rc_Ok

case "$1" in
    start)
	if [ ! -d /proc/asound ]; then
	  echo "ALSA driver is not running $rc_Err"
	else
	  echo -n "ALSA sound restore"
	  /usr/sbin/alsactl -F restore >/dev/null
	  if test $? != 0; then Retstat=$rc_Err; fi
	  echo "$Retstat"
	  /usr/bin/amixer set Master unmute >/dev/null 2>&1
	fi
        ;;
    stop)
	if [ -d /proc/asound ]; then
	  echo -n "ALSA sound restore"
	  /usr/sbin/alsactl store
	  if test $? != 0; then Retstat=$rc_Err; fi
	  echo "$Retstat"
	  /usr/bin/amixer set Master mute >/dev/null 2>&1
	fi
        ;;
    *)
	echo "Usage: {start|stop}"
	exit 1
	;;
esac
