NetBSD/etc/rc.d/mixerctl

52 lines
993 B
Bash
Executable File

#!/bin/sh
#
# $NetBSD: mixerctl,v 1.7 2004/01/11 13:57:56 uebayasi Exp $
#
# PROVIDE: mixerctl
# REQUIRE: mountcritremote
# KEYWORD: shutdown
. /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"