Update of /cvsroot/alsa/alsa-driver/utils
In directory sc8-pr-cvs1:/tmp/cvs-serv29865/utils

Added Files:
        alsasound.in alsasound.posix.in 
Removed Files:
        alsasound alsasound.posix 
Log Message:
alsasound.* scripts honors the --prefix now for alsa-utils programs

--- NEW FILE: alsasound.in ---
#!/bin/bash
#
# alsasound     This shell script takes care of starting and stopping
#               the ALSA sound driver.
#
# This script requires @prefix@/sbin/alsactl and @prefix@/bin/aconnect
# programs from the alsa-utils package.
#
# Copyright (c) by Jaroslav Kysela <[EMAIL PROTECTED]> 
#
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
#
#
# For RedHat 5.0+:
# chkconfig: 2345 87 14
# description: ALSA driver
#
# modified to visually fit into SuSE 6.0+ by Philipp Thomas <[EMAIL PROTECTED]>
# further improvements by Bernd Kaindl, Olaf Hering and Takashi Iwai.
# 
### BEGIN INIT INFO
# Provides:       alsasound
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start:  2 3 5
# Default-Stop:
# Description:    Loading ALSA drivers and store/restore the current setting
### END INIT INFO

if [ -r /etc/rc.config ]; then
  . /etc/rc.config
  rc_warning="\033[33m\033[1m"
else
  rc_done="done"
  rc_warning=""
  rc_reset=""
fi

if [ x$START_ALSA != xno ]; then
  START_ALSA=yes
fi
if [ x$START_ALSA_SEQ != xno ]; then
  START_ALSA_SEQ=yes
fi

# Determine the base and follow a runlevel link name.
base=${0##*/}
link=${base#*[SK][0-9][0-9]}

# Force execution if not called by a runlevel directory.
test $link = $base && START_ALSA=yes
test "$START_ALSA" = yes || exit 0

[EMAIL PROTECTED]@/sbin/alsactl
asoundcfg=/etc/asound.state
[EMAIL PROTECTED]@/bin/aconnect
alsascrdir=/etc/alsa.d
if [ -x /sbin/lsmod ]; then
  lsmod=/sbin/lsmod
else
  lsmod=lsmod
fi

# modprobe returns 255 when failed..
function probe_module () {
   /sbin/modprobe $*
   test $? = 0 && return 0
   return 1
}

function start() {
  #
  # insert all sound modules
  #

  module_loaded=0
  drivers=`/sbin/modprobe -c | \
    grep -E "^[[:space:]]*alias[[:space:]]+snd-card-[[:digit:]]" | \
    awk '{print $3}'`
  for i in $drivers; do
    if [ "$i" != off ]; then
      echo -n "Starting sound driver: $i "
      probe_module $i && module_loaded=1
      echo -e "$rc_done"
    fi
  done
  test $module_loaded -eq 0 && return
  #
  # insert sequencer modules
  #
  if [ x"$START_ALSA_SEQ" = xyes -a -r /proc/asound/seq/drivers ]; then
    cut -d , -f 1 /proc/asound/seq/drivers | \
    while read t ; do
      test -z $t || /sbin/modprobe $t
    done
  fi
  #
  # restore driver settings
  #
  if [ -d /proc/asound ]; then
    if [ ! -r $asoundcfg ]; then
      echo "No mixer config in $asoundcfg, you have to unmute your card!"
    else
      if [ -x $alsactl ]; then
        $alsactl -F -f $asoundcfg restore
      else
        echo -e "${rc_warning}ERROR: alsactl not found${rc_reset}"
      fi
    fi
  fi
  #
  # run card-dependent scripts
  for i in $drivers; do
    t=${i##snd-}
    if [ -x $alsascrdir/$t ]; then
      $alsascrdir/$t
    fi
  done

  #
  # touch lockfile if lockdir exists
  #
  if [ -d /var/lock/subsys ] ; then
    touch /var/lock/subsys/alsasound
  fi
}

function terminate() {
  #
  # Kill processes holding open sound devices
  #
  # DEVS=`find /dev/ -follow -type c -maxdepth 1 -print 2>/dev/null | xargs ls -dils | 
grep "1*1[46]," | cut -d: -f2 | cut -d" " -f2; echo /proc/asound/dev/*`
  fuser -k /dev/admmidi? /dev/adsp? /dev/amidi? /dev/audio* /dev/dmfm* \
     /dev/dmmidi? /dev/dsp* /dev/dspW* /dev/midi0? /dev/mixer? /dev/music \
     /dev/patmgr? /dev/sequencer* /dev/sndstat >/dev/null 2>&1
  if [ -d /proc/asound/dev ]; then
    fuser -k /proc/asound/dev/* >/dev/null 2>&1
  fi
  if [ -d /dev/snd ]; then
    fuser -k /dev/snd/* >/dev/null 2>&1
  fi
  #
  # remove all sequencer connections if any
  #
  if [ -f /proc/asound/seq/clients -a -x $aconnect ]; then
    $aconnect --removeall
  fi
}

function stop() {
  #
  # store driver settings
  #
  if [ -x $alsactl ]; then
    $alsactl -f $asoundcfg store
  else
    echo -n -e "${rc_warning}!!!alsactl not found!!!${rc_reset} "
  fi
  #
  # mute master to avoid clicks at unload
  #
  /usr/bin/amixer set Master mute >/dev/null 2>&1
  #
  # remove all sound modules
  #
  $lsmod | grep -E "^snd" | grep -Ev "(snd-page-alloc|snd_page_alloc)" | while read 
line; do \
     /sbin/rmmod `echo $line | cut -d ' ' -f 1`; \
  done
  # remove the 2.2 soundcore module (if possible)
  /sbin/rmmod soundcore 2> /dev/null
  /sbin/rmmod gameport 2> /dev/null

  #
  # remove lockfile if lockdir exists
  #
  if [ -d /var/lock/subsys ] ; then
    rm -f /var/lock/subsys/alsasound
  fi
}

# See how we were called.
case "$1" in
  start)
        # Start driver if it isn't already up.
        if [ ! -d /proc/asound ]; then
          start
        else
          echo "ALSA driver is already running."
        fi
        ;;
  stop)
        # Stop daemons.
        if [ -d /proc/asound ]; then
          echo -n "Shutting down sound driver: "
          terminate
          stop
          echo -e "$rc_done"
        fi
        ;;
  restart|reload)
        $0 stop
        $0 start
        ;;
  status)
        if [ -d /proc/asound ]; then
          echo -n "ALSA sound driver loaded."
        else
          echo -n "ALSA sound driver not loaded."
        fi
        echo
        ;;
  *)
        echo "Usage: alsasound {start|stop|restart|status}"
        exit 1
esac

exit 0

--- NEW FILE: alsasound.posix.in ---
#!/bin/sh
#
# alsasound     This shell script takes care of starting and stopping
#               the ALSA sound driver.
#
# This script requires @prefix@/sbin/alsactl program from
# alsa-utils package.
#
# Copyright (c) by Jaroslav Kysela <[EMAIL PROTECTED]> 
# Modified for being POSIX-complaint by Christian Kurz <[EMAIL PROTECTED]>
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
#
#
# For RedHat 5.0+:
# chkconfig: 2345 87 14
# description: ALSA driver
#

config=/etc/modules.conf
[EMAIL PROTECTED]@/sbin/alsactl
asoundcfg=/etc/asound.state
if [ -x /sbin/lsmod ]; then
  lsmod=/sbin/lsmod
else
  lsmod=lsmod
fi

if [ ! -r $config ]; then
  if [ -r /etc/conf.modules ]; then
    config=/etc/conf.modules
  fi
fi

# See how we were called.
case "$1" in
  start)
        # Start driver.
        if [ ! -d /proc/asound ]; then
          #
          # insert all sound modules
          #
          cat $config | \
                grep -E "^alias( |\t)+snd-card-[[:digit:]]" | \
                awk '{print $3}' | 
                while read line; do \
                  if [ "$line" != off ]; then \
                    echo -n "Starting sound driver: $line "; \
                    /sbin/modprobe $line; \
                    echo "done"; \
                  fi \
                done
          # 
          # restore driver settings
          #
          if [ -x $alsactl ]; then
            if [ -r $asoundcfg ]; then
              $alsactl -F -f $asoundcfg restore
            else
              echo "ERROR: alsactl can't start, $asoundcfg is not readable"
            fi
          else
            echo "ERROR: alsactl not found"
          fi
          #
          if [ -d /proc/asound ] && [ -d /var/lock/subsys ]; then
            touch /var/lock/subsys/alsasound
          fi
        else
          echo "ALSA driver is already running."
        fi
        ;;
  stop)
        # Stop daemons.
        if [ -d /proc/asound ]; then
          echo -n "Shutting down sound driver: "
          #
          # store driber settings
          #
          if [ -x $alsactl ]; then
            $alsactl -f $asoundcfg store
          else
            echo -n "ERROR: alsactl not found"
          fi
          #
          # remove all sound modules
          #
          $lsmod | grep -E "^snd" | grep -Ev "(snd-page-alloc|snd_page_alloc)" | while 
read line; do \
                /sbin/rmmod `echo $line | cut -d ' ' -f 1`; \
                done
          # remove the 2.2 soundcore module (if possible)
          /sbin/rmmod soundcore 2> /dev/null
          /sbin/rmmod gameport 2> /dev/null
          #
          if [ -d /var/lock/subsys ]; then
            rm -f /var/lock/subsys/alsasound
          fi
          echo "done"
        else
          echo "ALSA driver isn't running."
        fi
        ;;
  restart)
        $0 stop
        $0 start
        ;;
  *)
        echo "Usage: alsasound {start|stop|restart}"
        exit 1
esac

exit 0

--- alsasound DELETED ---

--- alsasound.posix DELETED ---



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog

Reply via email to