void-packages/srcpkgs/alsa-utils/files/alsamixer.rc

34 lines
627 B
Plaintext

#!/sbin/runscript
alsa_statedir=/var/lib/alsa
depend()
{
need localmount
after bootmisc modules coldplug hotplug
}
start()
{
ebegin "Restoring ALSA mixer settings"
[ ! -r ${alsa_statedir}/asound.state ] && eend 0
cards="$(sed -n -e 's/ *\([[:digit:]]*\) .*/\1/p' /proc/asound/cards)"
for cardnum in ${cards}; do
alsactl -f ${alsa_statedir}/asound.state restore ${cardnum} \
|| ewarn "Errors while restoring defaults, ignoring"
done
eend 0
}
stop()
{
ebegin "Storing ALSA mixer settings"
[ ! -d ${alsa_statedir} ] && mkdir -p ${alsa_statedir}
alsactl -f ${alsa_statedir}/asound.state store
eend $?
}