NetBSD/etc/rc.d/mixerctl
2004-10-11 15:00:51 +00:00

52 lines
1011 B
Bash
Executable File

#!/bin/sh
#
# $NetBSD: mixerctl,v 1.9 2004/10/11 15:00:51 christos 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
[ -z "$setting" ] || /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"