# alsa
#
# restores alsa settings

description	"Restore alsa settings"
author		"Arjan Bouter <abouter@sourcemage.org>"

start on mount_all-start
stop on shutdown

emits alsa-start alsa-stop

task

script
  [ -e /etc/sysconfig/alsa ] && . /etc/sysconfig/alsa
  declare -r ASOUNDCFG=/etc/asound.state
  [[ "$START_ALSA" == no ]]  &&  return 0
  if [[ -d /proc/asound ]]; then
    if ! [[ -r "$ASOUNDCFG" ]]; then
      echo "No mixer config in $ASOUNDCFG, you have to unmute your card!"
    else
      /usr/sbin/alsactl -f $ASOUNDCFG restore
    fi
  fi
  initctl emit alsa-start
end script
