[BACK]Return to mixerctl CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / etc / rc.d

File: [cvs.NetBSD.org] / src / etc / rc.d / mixerctl (download)

Revision 1.9.10.1, Sat Mar 31 15:38:55 2007 UTC (12 years, 8 months ago) by bouyer
Branch: netbsd-4
CVS Tags: wrstuden-fixsa-newbase, wrstuden-fixsa-base-1, wrstuden-fixsa-base, wrstuden-fixsa, netbsd-4-0-RELEASE, netbsd-4-0-RC5, netbsd-4-0-RC4, netbsd-4-0-RC3, netbsd-4-0-RC2, netbsd-4-0-RC1, netbsd-4-0-1-RELEASE, netbsd-4-0
Changes since 1.9: +7 -2 lines

Pull up following revision(s) (requested by abs in ticket #525):
	etc/rc.d/mixerctl: revision 1.10
Ignore comment (starting with #) lines in mixerctl.conf

#!/bin/sh
#
# $NetBSD: mixerctl,v 1.9.10.1 2007/03/31 15:38:55 bouyer 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"