mixerctl revision 1.7
11.1Sjmcneill#!/bin/sh
21.1Sjmcneill#
31.7Suebayasi# $NetBSD: mixerctl,v 1.7 2004/01/11 13:57:56 uebayasi 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.7Suebayasircvar=$name
141.1Sjmcneillstart_cmd="mixerctl_start"
151.5Skentstop_cmd="mixerctl_stop"
161.1Sjmcneill
171.1Sjmcneillmixerctl_start()
181.1Sjmcneill{
191.5Skent	if [ -n "$mixerctl_mixers" ]; then
201.5Skent		echo -n "Restoring mixer settings:"
211.5Skent		for mix in $mixerctl_mixers; do
221.5Skent			if [ -s /var/db/${mix}.conf ]; then
231.5Skent				echo -n " $mix"
241.6Stron				/usr/bin/mixerctl -d /dev/$mix -n -w \
251.5Skent					`/bin/cat /var/db/${mix}.conf`
261.5Skent			fi
271.5Skent		done
281.5Skent		echo "."
291.5Skent	fi
301.1Sjmcneill	if [ -r /etc/mixerctl.conf ]; then
311.1Sjmcneill		echo "Setting mixerctl variables..."
321.3Slukem		while read setting; do
331.5Skent			[ -z "$setting" ] || /usr/bin/mixerctl -n -w $setting
341.3Slukem		done < /etc/mixerctl.conf
351.5Skent	fi
361.5Skent}
371.5Skent
381.5Skentmixerctl_stop()
391.5Skent{
401.5Skent	if [ -n "$mixerctl_mixers" ]; then
411.5Skent		echo -n "Saving mixer settings:"
421.5Skent		for mix in $mixerctl_mixers; do
431.5Skent			echo -n " $mix"
441.6Stron			/usr/bin/mixerctl -d /dev/$mix -a > /var/db/${mix}.conf
451.5Skent		done
461.5Skent		echo "."
471.1Sjmcneill	fi
481.1Sjmcneill}
491.1Sjmcneill
501.1Sjmcneillload_rc_config $name
511.1Sjmcneillrun_rc_command "$1"
52