11.1Sjmcneill#!/bin/sh
21.1Sjmcneill#
31.10Sabs# $NetBSD: mixerctl,v 1.10 2007/03/16 22:30:22 abs Exp $
41.1Sjmcneill#
51.1Sjmcneill
61.1Sjmcneill# PROVIDE: mixerctl
71.3Slukem# REQUIRE: mountcritremote
81.5Skent# KEYWORD: shutdown
91.1Sjmcneill
101.8Smycroft$_rc_subr_loaded . /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.9Schristos					$(/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.10Sabs			case "$setting" in
341.10Sabs			\#*|"")
351.10Sabs				continue
361.10Sabs				;;
371.10Sabs			esac
381.10Sabs			/usr/bin/mixerctl -n -w $setting
391.3Slukem		done < /etc/mixerctl.conf
401.5Skent	fi
411.5Skent}
421.5Skent
431.5Skentmixerctl_stop()
441.5Skent{
451.5Skent	if [ -n "$mixerctl_mixers" ]; then
461.5Skent		echo -n "Saving mixer settings:"
471.5Skent		for mix in $mixerctl_mixers; do
481.5Skent			echo -n " $mix"
491.6Stron			/usr/bin/mixerctl -d /dev/$mix -a > /var/db/${mix}.conf
501.5Skent		done
511.5Skent		echo "."
521.1Sjmcneill	fi
531.1Sjmcneill}
541.1Sjmcneill
551.1Sjmcneillload_rc_config $name
561.1Sjmcneillrun_rc_command "$1"
57