]>
Commit | Line | Data |
---|---|---|
2c9e731e | 1 | #!/bin/sh |
2 | # | |
3 | # aumix Sound mixer setup. | |
4 | # | |
5 | # chkconfig: 345 85 15 | |
6 | # | |
7 | # description: Saves sound mixer's settings on system shutdown and restores | |
8 | # them on system startup. | |
9 | ||
10 | # Source function library | |
11 | . /etc/rc.d/init.d/functions | |
12 | ||
f9cf8dcf JB |
13 | . /etc/sysconfig/aumix |
14 | ||
2c9e731e | 15 | # See how we were called. |
16 | case "$1" in | |
17 | start) | |
18 | # Check if the service is already running? | |
19 | if [ ! -f /var/lock/subsys/aumix ]; then | |
20 | show "Setting up sound card mixer" | |
21 | busy | |
f9cf8dcf JB |
22 | if [ "$AUMIX_AUTO_INIT" = "yes" ]; then |
23 | aumix -f /etc/aumixrc -L >/dev/null | |
24 | RETVAL=$? | |
25 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/aumix | |
26 | else | |
27 | touch /var/lock/subsys/aumix | |
28 | fi | |
2c9e731e | 29 | ok |
30 | else | |
2c9e731e | 31 | nls "Sound card mixer is already set up" |
32 | exit 1 | |
33 | fi | |
34 | ;; | |
35 | stop) | |
2c9e731e | 36 | if [ -f /var/lock/subsys/aumix ]; then |
37 | show "Saving sound card mixer's settings" | |
38 | busy | |
f9cf8dcf JB |
39 | if [ "$AUMIX_AUTO_SAVE" = "yes" ]; then |
40 | aumix -f /etc/aumixrc -S | |
41 | fi | |
2c9e731e | 42 | rm -f /var/lock/subsys/aumix >/dev/null 2>&1 |
43 | ok | |
44 | else | |
45 | nls "Sound card mixer hasn't been set up" | |
46 | exit 1 | |
47 | fi | |
48 | ;; | |
49 | restart) | |
50 | $0 stop | |
51 | $0 start | |
52 | ;; | |
53 | save) | |
54 | show "Saving sound card mixer's settings" | |
55 | busy | |
56 | aumix -f /etc/aumixrc -S | |
57 | ok | |
58 | ;; | |
59 | restore) | |
60 | show "Setting up sound card mixer" | |
61 | busy | |
62 | aumix -f /etc/aumixrc -L >/dev/null | |
63 | ok | |
64 | ;; | |
65 | status) | |
fb98ef94 | 66 | cat /proc/devices | grep -q "\(sparcaudio\|sound\)" |
67 | if [ $? = 0 ]; then | |
68 | lsmod | grep -q "\(sound\|audio\)" | |
69 | if [ $? = 0 ]; then | |
70 | echo "Modular sound card detected." | |
71 | else | |
72 | echo "Monolithic sound card detected." | |
73 | fi | |
74 | ||
75 | cat /dev/sndstat 2> /dev/null | grep -A 1 "Midi devices:" | grep -q [0-9]: | |
76 | if [ $? = 0 ]; then | |
77 | echo "MIDI device present." | |
78 | else | |
79 | cat /dev/sndstat >/dev/null 2>&1 | |
80 | if [ $? = 0 ]; then | |
81 | echo "MIDI device not detected." | |
82 | fi | |
83 | fi | |
84 | ||
85 | else | |
86 | echo "Sound card not configured." | |
87 | fi | |
2c9e731e | 88 | ;; |
89 | *) | |
429d017e | 90 | msg_usage "$0 {start|stop|status|restart|save|restore}" |
2c9e731e | 91 | exit 1 |
92 | esac | |
93 | ||
94 | exit $RETVAL |