2002-06-02 22:36:46 +04:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2004-10-11 19:00:51 +04:00
|
|
|
# $NetBSD: mixerctl,v 1.9 2004/10/11 15:00:51 christos Exp $
|
2002-06-02 22:36:46 +04:00
|
|
|
#
|
|
|
|
|
|
|
|
# PROVIDE: mixerctl
|
2002-06-11 20:31:41 +04:00
|
|
|
# REQUIRE: mountcritremote
|
2002-10-12 15:29:28 +04:00
|
|
|
# KEYWORD: shutdown
|
2002-06-02 22:36:46 +04:00
|
|
|
|
2004-08-13 22:08:03 +04:00
|
|
|
$_rc_subr_loaded . /etc/rc.subr
|
2002-06-02 22:36:46 +04:00
|
|
|
|
|
|
|
name="mixerctl"
|
2004-01-11 16:57:56 +03:00
|
|
|
rcvar=$name
|
2002-06-02 22:36:46 +04:00
|
|
|
start_cmd="mixerctl_start"
|
2002-10-12 15:29:28 +04:00
|
|
|
stop_cmd="mixerctl_stop"
|
2002-06-02 22:36:46 +04:00
|
|
|
|
|
|
|
mixerctl_start()
|
|
|
|
{
|
2002-10-12 15:29:28 +04:00
|
|
|
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"
|
2003-08-18 17:04:10 +04:00
|
|
|
/usr/bin/mixerctl -d /dev/$mix -n -w \
|
2004-10-11 19:00:51 +04:00
|
|
|
$(/bin/cat /var/db/${mix}.conf)
|
2002-10-12 15:29:28 +04:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
echo "."
|
|
|
|
fi
|
2002-06-02 22:36:46 +04:00
|
|
|
if [ -r /etc/mixerctl.conf ]; then
|
|
|
|
echo "Setting mixerctl variables..."
|
2002-06-11 20:31:41 +04:00
|
|
|
while read setting; do
|
2002-10-12 15:29:28 +04:00
|
|
|
[ -z "$setting" ] || /usr/bin/mixerctl -n -w $setting
|
2002-06-11 20:31:41 +04:00
|
|
|
done < /etc/mixerctl.conf
|
2002-06-02 22:36:46 +04:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2002-10-12 15:29:28 +04:00
|
|
|
mixerctl_stop()
|
|
|
|
{
|
|
|
|
if [ -n "$mixerctl_mixers" ]; then
|
|
|
|
echo -n "Saving mixer settings:"
|
|
|
|
for mix in $mixerctl_mixers; do
|
|
|
|
echo -n " $mix"
|
2003-08-18 17:04:10 +04:00
|
|
|
/usr/bin/mixerctl -d /dev/$mix -a > /var/db/${mix}.conf
|
2002-10-12 15:29:28 +04:00
|
|
|
done
|
|
|
|
echo "."
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2002-06-02 22:36:46 +04:00
|
|
|
load_rc_config $name
|
|
|
|
run_rc_command "$1"
|