Subject: /etc/rc.d/mixerctl
To: None <tech-userlevel@netbsd.org>
From: TAMURA Kent <kent@netbsd.org>
List: tech-userlevel
Date: 10/11/2002 13:47:56
How about the following change? It saves all mixer values at
the shutdown stage and restore them at the boot stage.
--
TAMURA Kent <kent2002@hauN.org> <kent@netbsd.org>
Index: mixerctl
===================================================================
RCS file: /cvsroot/basesrc/etc/rc.d/mixerctl,v
retrieving revision 1.4
diff -u -r1.4 mixerctl
--- mixerctl 2002/07/16 03:24:24 1.4
+++ mixerctl 2002/10/11 04:45:20
@@ -5,21 +5,34 @@
# PROVIDE: mixerctl
# REQUIRE: mountcritremote
+# KEYWORD: shutdown
. /etc/rc.subr
name="mixerctl"
start_cmd="mixerctl_start"
-stop_cmd=":"
+stop_cmd="mixerctl_stop"
mixerctl_start()
{
+ if [ -r /var/db/mixerctl.conf ]; then
+ echo "Restoring mixerctl variables..."
+ while read setting; do
+ [ -z "$setting" ] || /usr/bin/mixerctl -n -w $setting
+ done < /var/db/mixerctl.conf
+ fi
if [ -r /etc/mixerctl.conf ]; then
echo "Setting mixerctl variables..."
while read setting; do
- [ -z "$setting" ] || mixerctl -n -w $setting
+ [ -z "$setting" ] || /usr/bin/mixerctl -n -w $setting
done < /etc/mixerctl.conf
fi
+}
+
+mixerctl_stop()
+{
+ echo "Saving mixerctl variables..."
+ /usr/bin/mixerctl -a > /var/db/mixerctl.conf
}
load_rc_config $name