1#! /bin/sh
2#
3# mixer    Save/restore mixer settings on bootup
4# Thanks to Leon Breedt <ljb@debian.org> for this.
5#
6# Modified by Sakari Lehtonen <sakari@ionstream.fi> to work with multiple
7# mixers (well, at least with aumix and umix).
8#
9
10NAME=mixer
11CONF=/etc/umixrc
12PROG=/usr/bin/umix
13MIXER=umix
14
15[ -x $PROG ] || exit 0
16
17if [ -x /etc/init.d/alsa ]; then
18    alsactl='(alsactl not found)'
19    eval `grep '^alsactl=' /etc/init.d/alsa | head -1`
20    if [ -x $alsactl ]; then
21        echo "ALSA detected, so $MIXER will not touch the mixer settings."
22        exit 0
23    fi
24    echo "ALSA detected, but $alsactl not usable, carrying on with $MIXER."
25fi
26
27case "$1" in
28    start|restart|reload|force-reload)
29        if [ -f $CONF ]; then
30            echo -n "Restoring mixer settings: "
31            $PROG -f $CONF -L >/dev/null
32            echo "done."
33        fi
34        ;;
35    save|stop)
36        echo -n "Saving mixer settings: "
37        $PROG -f $CONF -S 2>&1 >/dev/null
38        echo "done."
39        ;;
40    *)
41        echo "Usage: /etc/init.d/$NAME {start|stop|save}"
42        exit 1
43        ;;
44esac
45
46exit 0
47