NetBSD/etc/rc.d/mixerctl
2002-10-12 11:29:28 +00:00

51 lines
977 B
Bash
Executable File

#!/bin/sh
#
# $NetBSD: mixerctl,v 1.5 2002/10/12 11:29:29 kent Exp $
#
# PROVIDE: mixerctl
# REQUIRE: mountcritremote
# KEYWORD: shutdown
. /etc/rc.subr
name="mixerctl"
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 -f /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 -f /dev/$mix -a > /var/db/${mix}.conf
done
echo "."
fi
}
load_rc_config $name
run_rc_command "$1"