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