]>
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 | ||
cc518591 | 13 | [ -f /etc/sysconfig/aumix ] && . /etc/sysconfig/aumix |
f9cf8dcf | 14 | |
f610569b | 15 | RETVAL=$? |
2c9e731e | 16 | # See how we were called. |
17 | case "$1" in | |
18 | start) | |
19 | # Check if the service is already running? | |
20 | if [ ! -f /var/lock/subsys/aumix ]; then | |
21 | show "Setting up sound card mixer" | |
22 | busy | |
f9cf8dcf | 23 | if [ "$AUMIX_AUTO_INIT" = "yes" ]; then |
3ef9fd92 | 24 | aumix -f /etc/aumixrc -L >/dev/null |
f9cf8dcf | 25 | RETVAL=$? |
f9cf8dcf | 26 | fi |
3ef9fd92 | 27 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/aumix && ok || fail |
2c9e731e | 28 | else |
2c9e731e | 29 | nls "Sound card mixer is already set up" |
2c9e731e | 30 | fi |
31 | ;; | |
32 | stop) | |
2c9e731e | 33 | if [ -f /var/lock/subsys/aumix ]; then |
34 | show "Saving sound card mixer's settings" | |
35 | busy | |
f9cf8dcf JB |
36 | if [ "$AUMIX_AUTO_SAVE" = "yes" ]; then |
37 | aumix -f /etc/aumixrc -S | |
38 | fi | |
2c9e731e | 39 | rm -f /var/lock/subsys/aumix >/dev/null 2>&1 |
40 | ok | |
41 | else | |
42 | nls "Sound card mixer hasn't been set up" | |
2c9e731e | 43 | fi |
44 | ;; | |
f610569b | 45 | restart|force-reload) |
2c9e731e | 46 | $0 stop |
47 | $0 start | |
f610569b | 48 | exit $0 |
2c9e731e | 49 | ;; |
50 | save) | |
3ef9fd92 | 51 | run_cmd "Saving sound card mixer's settings" aumix -f /etc/aumixrc -S |
2c9e731e | 52 | ;; |
f610569b | 53 | restore|reload) |
2c9e731e | 54 | show "Setting up sound card mixer" |
55 | busy | |
56 | aumix -f /etc/aumixrc -L >/dev/null | |
57 | ok | |
58 | ;; | |
59 | status) | |
fb98ef94 | 60 | cat /proc/devices | grep -q "\(sparcaudio\|sound\)" |
61 | if [ $? = 0 ]; then | |
62 | lsmod | grep -q "\(sound\|audio\)" | |
63 | if [ $? = 0 ]; then | |
ceb8761c | 64 | nls "Modular sound card detected." |
fb98ef94 | 65 | else |
ceb8761c | 66 | nls "Monolithic sound card detected." |
fb98ef94 | 67 | fi |
68 | ||
69 | cat /dev/sndstat 2> /dev/null | grep -A 1 "Midi devices:" | grep -q [0-9]: | |
70 | if [ $? = 0 ]; then | |
ceb8761c | 71 | nls "MIDI device present." |
fb98ef94 | 72 | else |
73 | cat /dev/sndstat >/dev/null 2>&1 | |
74 | if [ $? = 0 ]; then | |
ceb8761c | 75 | nls "MIDI device not detected." |
fb98ef94 | 76 | fi |
77 | fi | |
78 | ||
79 | else | |
ceb8761c | 80 | nls "Sound card not configured." |
fb98ef94 | 81 | fi |
2c9e731e | 82 | ;; |
83 | *) | |
f610569b | 84 | msg_usage "$0 {start|stop|restart|reload|force-reload|save|restore|status}" |
85 | exit 3 | |
2c9e731e | 86 | esac |
87 | ||
88 | exit $RETVAL |