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