Merge branch 'vendor/BIND' into bind_vendor2
[dragonfly.git] / etc / rc.d / mixer
1 #!/bin/sh
2 #
3 # $DragonFly: src/etc/rc.d/mixer,v 1.8 2005/11/19 21:47:32 swildner Exp $
4 #
5
6 # PROVIDE: mixer
7 # REQUIRE: DAEMON
8 # BEFORE:  LOGIN
9 # KEYWORD: shutdown
10
11 . /etc/rc.subr
12
13 name="mixer"
14 rcvar=`set_rcvar`
15 start_cmd="mixer_start"
16 stop_cmd="mixer_stop"
17 mixer_conf=/etc/mixer.conf
18
19 mixer_start()
20 {
21         if [ -r $mixer_conf ]; then
22                 echo "Loading mixer settings"
23                 xargs -L 1 mixer < $mixer_conf
24         fi
25 }
26
27 mixer_stop()
28 {
29         [ -z "$mixer_conf" ] && return
30         if [ -w $mixer_conf -o \( ! -e $mixer_conf -a -w `dirname $mixer_conf` \) ]; then
31                 echo "Storing mixer settings"
32                 > $mixer_conf
33                 for f in /dev/mixer[0-9]*; do
34                         printf "-f %s %s\n" "$f" "$(mixer -f "$f" -s)" >> $mixer_conf
35                 done
36         fi
37 }
38
39 load_rc_config $name
40 run_rc_command "$1"