mixerctl revision 1.6
11.1Sjmcneill#!/bin/sh
21.1Sjmcneill#
31.6Stron# $NetBSD: mixerctl,v 1.6 2003/08/18 13:04:10 tron Exp $
41.1Sjmcneill#
51.1Sjmcneill
61.1Sjmcneill# PROVIDE: mixerctl
71.3Slukem# REQUIRE: mountcritremote
81.5Skent# KEYWORD: shutdown
91.1Sjmcneill
101.1Sjmcneill. /etc/rc.subr
111.1Sjmcneill
121.1Sjmcneillname="mixerctl"
131.1Sjmcneillstart_cmd="mixerctl_start"
141.5Skentstop_cmd="mixerctl_stop"
151.1Sjmcneill
161.1Sjmcneillmixerctl_start()
171.1Sjmcneill{
181.5Skent	if [ -n "$mixerctl_mixers" ]; then
191.5Skent		echo -n "Restoring mixer settings:"
201.5Skent		for mix in $mixerctl_mixers; do
211.5Skent			if [ -s /var/db/${mix}.conf ]; then
221.5Skent				echo -n " $mix"
231.6Stron				/usr/bin/mixerctl -d /dev/$mix -n -w \
241.5Skent					`/bin/cat /var/db/${mix}.conf`
251.5Skent			fi
261.5Skent		done
271.5Skent		echo "."
281.5Skent	fi
291.1Sjmcneill	if [ -r /etc/mixerctl.conf ]; then
301.1Sjmcneill		echo "Setting mixerctl variables..."
311.3Slukem		while read setting; do
321.5Skent			[ -z "$setting" ] || /usr/bin/mixerctl -n -w $setting
331.3Slukem		done < /etc/mixerctl.conf
341.5Skent	fi
351.5Skent}
361.5Skent
371.5Skentmixerctl_stop()
381.5Skent{
391.5Skent	if [ -n "$mixerctl_mixers" ]; then
401.5Skent		echo -n "Saving mixer settings:"
411.5Skent		for mix in $mixerctl_mixers; do
421.5Skent			echo -n " $mix"
431.6Stron			/usr/bin/mixerctl -d /dev/$mix -a > /var/db/${mix}.conf
441.5Skent		done
451.5Skent		echo "."
461.1Sjmcneill	fi
471.1Sjmcneill}
481.1Sjmcneill
491.1Sjmcneillload_rc_config $name
501.1Sjmcneillrun_rc_command "$1"
51