#!/bin/sh
# unmute the sound card at boot

case $1 in

'start')
    if [ -e /etc/asound.state ]; then
        echo -n "Restoring asound.state: "
        OP=restore
    else 
        echo -n "Intializing sound to defaults: "
        OP=init
    fi
    ;;
'stop'|'restart')
    echo -n "Storing asound.state: "
    OP=store
    ;;
*)
    echo "Usage: $0 [start|stop|restart]"
    exit 1
    ;;
esac

if alsactl $OP; then
    echo "[ OK ]"
else
    if [ "$OP" == init -a $? == 99 ]; then
        echo "[ OK ]"
    else
        echo "[ FAILED ]"
    fi
fi

