]> git.pld-linux.org Git - packages/aumix.git/blobdiff - aumix.init
- s/OSS-preserve-settings/preserve-settings/ - this also works for ALSA
[packages/aumix.git] / aumix.init
index 017dc0f7eed96a6a3b004c2362df4ad8117b7759..963a8c8ab6a780f4c0aa0922eb51de0e5d5f98e6 100644 (file)
@@ -2,16 +2,17 @@
 #
 # aumix                Sound mixer setup.
 #
-# chkconfig:    345  85 15
+# chkconfig:   345 85 15
 #
-# description: Saves sound mixer's settings on system shutdown and restores
+# description: Saves sound mixer's settings on system shutdown and restores \
 #              them on system startup.
 
 # Source function library
 . /etc/rc.d/init.d/functions
 
-. /etc/sysconfig/aumix
+[ -f /etc/sysconfig/aumix ] && . /etc/sysconfig/aumix
 
+RETVAL=0
 # See how we were called.
 case "$1" in
   start)
@@ -22,16 +23,12 @@ case "$1" in
                if [ "$AUMIX_AUTO_INIT" = "yes" ]; then
                        aumix -f /etc/aumixrc -L >/dev/null
                        RETVAL=$?
-                       [ $RETVAL -eq 0 ] && touch /var/lock/subsys/aumix
-               else
-                       touch /var/lock/subsys/aumix
                fi
-               ok
+               [ $RETVAL -eq 0 ] && touch /var/lock/subsys/aumix && ok || fail
        else
                nls "Sound card mixer is already set up"
-               exit 1
        fi
-        ;;
+       ;;
   stop)
        if [ -f /var/lock/subsys/aumix ]; then
                show "Saving sound card mixer's settings"
@@ -43,20 +40,17 @@ case "$1" in
                ok
        else
                nls "Sound card mixer hasn't been set up"
-               exit 1
        fi      
-        ;;
-  restart)
-        $0 stop
+       ;;
+  restart|force-reload)
+       $0 stop
        $0 start
-        ;;
+       exit $0
+       ;;
   save)
-       show "Saving sound card mixer's settings"
-       busy
-       aumix -f /etc/aumixrc -S
-       ok
-       ;;
-  restore)
+       run_cmd "Saving sound card mixer's settings" aumix -f /etc/aumixrc -S
+       ;;
+  restore|reload)
        show "Setting up sound card mixer"
        busy
        aumix -f /etc/aumixrc -L >/dev/null
@@ -67,28 +61,28 @@ case "$1" in
        if [ $? = 0 ]; then
                lsmod | grep -q "\(sound\|audio\)"
                if [ $? = 0 ]; then
-                       echo "Modular sound card detected."
+                       nls "Modular sound card detected."
                else
-                       echo "Monolithic sound card detected."
+                       nls "Monolithic sound card detected."
                fi
  
                cat /dev/sndstat 2> /dev/null | grep -A 1 "Midi devices:" | grep -q [0-9]:
                if [ $? = 0 ]; then
-                       echo "MIDI device present."
+                       nls "MIDI device present."
                else
                        cat /dev/sndstat >/dev/null 2>&1
                        if [ $? = 0 ]; then
-                               echo "MIDI device not detected."
+                               nls "MIDI device not detected."
                        fi
-               fi    
+               fi
 
        else
-               echo "Sound card not configured."
-        fi
-        ;;
+               nls "Sound card not configured."
+       fi
+       ;;
   *)
-       msg_usage "$0 {start|stop|status|restart|save|restore}"
-        exit 1
+       msg_usage "$0 {start|stop|restart|reload|force-reload|save|restore|status}"
+       exit 3
 esac
 
 exit $RETVAL
This page took 0.031586 seconds and 4 git commands to generate.