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