]> git.pld-linux.org Git - packages/aumix.git/blob - aumix.init
- killed trailing spaces/tabs
[packages/aumix.git] / aumix.init
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 [ -f /etc/sysconfig/aumix ] && . /etc/sysconfig/aumix
14
15 RETVAL=0
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
23                 if [ "$AUMIX_AUTO_INIT" = "yes" ]; then
24                         aumix -f /etc/aumixrc -L >/dev/null
25                         RETVAL=$?
26                 fi
27                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/aumix && ok || fail
28         else
29                 nls "Sound card mixer is already set up"
30         fi
31         ;;
32   stop)
33         if [ -f /var/lock/subsys/aumix ]; then
34                 show "Saving sound card mixer's settings"
35                 busy
36                 if [ "$AUMIX_AUTO_SAVE" = "yes" ]; then
37                         aumix -f /etc/aumixrc -S
38                 fi
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"
43         fi
44         ;;
45   restart|force-reload)
46         $0 stop
47         $0 start
48         ;;
49   save)
50         run_cmd "Saving sound card mixer's settings" aumix -f /etc/aumixrc -S
51         ;;
52   restore|reload)
53         show "Setting up sound card mixer"
54         busy
55         aumix -f /etc/aumixrc -L >/dev/null
56         ok
57         ;;
58   status)
59         cat /proc/devices | grep -q "\(sparcaudio\|sound\)"
60         if [ $? = 0 ]; then
61                 lsmod | grep -q "\(sound\|audio\)"
62                 if [ $? = 0 ]; then
63                         nls "Modular sound card detected."
64                 else
65                         nls "Monolithic sound card detected."
66                 fi
67
68                 cat /dev/sndstat 2> /dev/null | grep -A 1 "Midi devices:" | grep -q [0-9]:
69                 if [ $? = 0 ]; then
70                         nls "MIDI device present."
71                 else
72                         cat /dev/sndstat >/dev/null 2>&1
73                         if [ $? = 0 ]; then
74                                 nls "MIDI device not detected."
75                         fi
76                 fi
77
78         else
79                 nls "Sound card not configured."
80         fi
81         ;;
82   *)
83         msg_usage "$0 {start|stop|restart|reload|force-reload|save|restore|status}"
84         exit 3
85 esac
86
87 exit $RETVAL
This page took 0.031858 seconds and 3 git commands to generate.