#!/bin/sh # # aumix Sound mixer setup. # # chkconfig: 345 85 15 # # 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 # See how we were called. case "$1" in start) # Check if the service is already running? if [ ! -f /var/lock/subsys/aumix ]; then show "Setting up sound card mixer" busy 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 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" busy if [ "$AUMIX_AUTO_SAVE" = "yes" ]; then aumix -f /etc/aumixrc -S fi rm -f /var/lock/subsys/aumix >/dev/null 2>&1 ok else nls "Sound card mixer hasn't been set up" exit 1 fi ;; restart) $0 stop $0 start ;; save) show "Saving sound card mixer's settings" busy aumix -f /etc/aumixrc -S ok ;; restore) show "Setting up sound card mixer" busy aumix -f /etc/aumixrc -L >/dev/null ok ;; status) cat /proc/devices | grep -q "\(sparcaudio\|sound\)" if [ $? = 0 ]; then lsmod | grep -q "\(sound\|audio\)" if [ $? = 0 ]; then echo "Modular sound card detected." else echo "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." else cat /dev/sndstat >/dev/null 2>&1 if [ $? = 0 ]; then echo "MIDI device not detected." fi fi else echo "Sound card not configured." fi ;; *) msg_Usage "$0 {start|stop|status|restart|save|restore}" exit 1 esac exit $RETVAL