NetBSD/etc/rc.d/mixerctl

57 lines
1.0 KiB
Bash
Executable File

#!/bin/sh
#
# $NetBSD: mixerctl,v 1.10 2007/03/16 22:30:22 abs Exp $
#
# PROVIDE: mixerctl
# REQUIRE: mountcritremote
# KEYWORD: shutdown
$_rc_subr_loaded . /etc/rc.subr
name="mixerctl"
rcvar=$name
start_cmd="mixerctl_start"
stop_cmd="mixerctl_stop"
mixerctl_start()
{
if [ -n "$mixerctl_mixers" ]; then
echo -n "Restoring mixer settings:"
for mix in $mixerctl_mixers; do
if [ -s /var/db/${mix}.conf ]; then
echo -n " $mix"
/usr/bin/mixerctl -d /dev/$mix -n -w \
$(/bin/cat /var/db/${mix}.conf)
fi
done
echo "."
fi
if [ -r /etc/mixerctl.conf ]; then
echo "Setting mixerctl variables..."
while read setting; do
case "$setting" in
\#*|"")
continue
;;
esac
/usr/bin/mixerctl -n -w $setting
done < /etc/mixerctl.conf
fi
}
mixerctl_stop()
{
if [ -n "$mixerctl_mixers" ]; then
echo -n "Saving mixer settings:"
for mix in $mixerctl_mixers; do
echo -n " $mix"
/usr/bin/mixerctl -d /dev/$mix -a > /var/db/${mix}.conf
done
echo "."
fi
}
load_rc_config $name
run_rc_command "$1"