Hello!

We added these patches in the last few weeks.

For the alsaconf patch, it's the changes I made to the script to make it
work on Debian. It still lacks propper unbashization (removing let's,
etc).

More flavours could be added to the distributions detection, and adding
distro-specific stuff to it.

Jordi
-- 
Jordi Mallach Pérez  --  Debian developer     http://www.debian.org/
[EMAIL PROTECTED]     [EMAIL PROTECTED]     http://www.sindominio.net/
GnuPG public key information available at http://oskuro.net/~jordi/
#! /bin/sh -e

# 04_alsaconf_bashisms.dpatch by Jordi Mallach
#
# DP: Use /bin/bash, not /bin/sh so it works with /bin/sh -> dash.
# DP: Fix a bunch of bashisms and gawkisms.
# DP: Adapt alsconf to Debian needs, by calling the correct scripts
# DP: and writing configuration where it belongs.

. debian/patches/patch-opts

if [ $# -ne 1 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi
case "$1" in
    -patch) patch $patch_opts < $0;;
    -unpatch) patch $patch_opts -R < $0;;
    *)
        echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
        exit 1;;
esac

exit 0

--- alsa-driver-0.9.0rc6+2.orig/utils/alsaconf  2003-01-31 17:50:27.000000000 +0100
+++ alsa-driver-0.9.0rc6+2/utils/alsaconf       2003-01-31 17:58:21.000000000 +0100
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 #
 #  ALSA Configurator
 #
@@ -25,7 +25,14 @@
   exit 1
 fi
 
-function usage() {
+# Check for GNU/Linux distributions
+if [ -f /etc/debian_version ]; then
+  distribution="debian"
+elif [ -f /etc/redhat-release ]; then
+  distribution="redhat"
+fi
+
+usage() {
     echo "ALSA configurator version $version"
     echo "usage: alsaconf [options]"
     echo "  -l|--legacy    check only legacy non-isapnp cards"
@@ -54,8 +61,8 @@
 alsa_gid=0
 alsa_mode=0666
 legacy_probe_card=""
-LOGFILE=/tmp/alsaconf.log
-TESTSOUND=/usr/share/sounds/alsa/test.wav
+LOGFILE="/tmp/alsaconf.log"
+TESTSOUND="/usr/share/sounds/alsa/test.wav"
 try_all_combination=0
 
 while true ; do
@@ -96,7 +103,9 @@
     alsa_device_opts="$alsa_device_opts ${mpfx}device_mode=$alsa_mode"
 fi
 
-if [ -e /etc/modules.conf ]; then
+if [ "$distribution" = "debian" ]; then
+  cfgfile="/etc/alsa/modutils/0.9"
+elif [ -e /etc/modules.conf ]; then
   cfgfile="/etc/modules.conf"
 elif [ -e /etc/conf.modules ]; then
   cfgfile="/etc/conf.modules"
@@ -120,7 +129,7 @@
   DIALOG=dialog
 else
   if which whiptail > /dev/null; then
-    function whiptail_wrapper() {
+    whiptail_wrapper() {
       X1="$1"
       X2="$2"
       if [ $1 = --yesno ]; then
@@ -146,7 +155,7 @@
 #
 # remove entries by yast2 sound configurator
 #
-function remove_y2_block() {
+remove_y2_block() {
     awk '
     /^alias sound-slot-[0-9]/ { next }
     /^alias char-major-116 / { next }
@@ -166,7 +175,7 @@
 # found strings to search for in WriteConfModules, 
 # from sndconfig 0.68-4 (rawhide version)
 
-function remove_sndconfig_block() {
+remove_sndconfig_block() {
     awk '
     /^alias sound-slot-0/ { modulename = $3 ; next }
     /^alias sound-slot-[0-9]/ { next }
@@ -192,18 +201,18 @@
 #
 # remove the previous configuration by alsaconf
 #
-function remove_ac_block() {
+remove_ac_block() {
     awk '/^'"$ACB"'$/,/^'"$ACE"'$/ { next } { print }'
 }
 
 #
 # set default mixer volumes
 #
-function mixer() {
+mixer() {
   amixer set "$1" "$2" unmute >/dev/null 2>&1
 }
 
-function set_mixers() {
+set_mixers() {
     mixer Master 75%
     mixer PCM 90%
     mixer Synth 90%
@@ -224,7 +233,7 @@
 
 
 # INTRO
-function intro() {
+intro() {
 $DIALOG --msgbox "
                    ALSA  CONFIGURATOR
                           v$version
@@ -240,7 +249,7 @@
 }
 
 # FAREWELL
-function farewell() {
+farewell() {
 $DIALOG --msgbox "
 
      $*
@@ -249,7 +258,7 @@
 
           will prepare the card for playing now.
 
-     Now I'll run 'alsasound start', then I'll use
+     Now I'll run '`basename $rcalsasound` start', then I'll use
      amixer to raise the default volumes.
      You can change the volume later via a mixer
      program such as alsamixer or gamix.
@@ -258,7 +267,7 @@
 }
 
 # Exit function
-function acex() {
+acex() {
   cleanup
   clear
   exit $1
@@ -267,7 +276,10 @@
 #
 # search for alsasound init script
 #
-if [ -x /etc/init.d/alsasound ]; then
+
+if [ "$distribution" = "debian" ]; then
+    rcalsasound=/etc/init.d/alsa
+elif [ -x /etc/init.d/alsasound ]; then
     rcalsasound=/etc/init.d/alsasound
 elif [ -x /usr/sbin/rcalsasound ]; then
     rcalsasound=/usr/sbin/rcalsasound
@@ -310,7 +322,7 @@
 trap cleanup 0 
 
 # convert ISA PnP id number to string 'ABC'
-function convert_isapnp_id () {
+convert_isapnp_id () {
     let a='('$1'>>2) & 0x3f'
     let b='(('$1' & 0x03) << 3) | (('$1' >> 13) & 0x07)'
     let c='('$1'>> 8) & 0x1f'
@@ -319,14 +331,14 @@
 }
 
 # swap high & low bytes
-function swap_number () {
+swap_number () {
     let v='(('$1'>>8)&0xff)|(('$1'&0xff)<<8)'
     printf "%04x" $v
 }
 
 # build card database
 # build_card_db filename
-function build_card_db () {
+build_card_db () {
     MODDIR=/lib/modules/`uname -r`
     last_driver=""
     echo -n > $1
@@ -363,7 +375,7 @@
 #
 # probe cards
 #
-function probe_cards () {
+probe_cards () {
     test -r /proc/isapnp || /sbin/modprobe isapnp >/dev/null 2>&1
     test -r /proc/isapnp || /sbin/modprobe isa-pnp >/dev/null 2>&1
     if [ -r /proc/isapnp ]; then
@@ -403,14 +415,14 @@
        print perc;
        idx++;
 }
-/^[[:space:]]*PCI: /{
+/^[<literal space><literal tab>]*PCI: /{
        gsub(/0x/, "");
        gsub(/=/, ":");
        x = sprintf ("/sbin/lspci -n | grep '"'Class 0401'"' | grep %s", $2);
        if (system (x) == 0)
                printf "%s %s\n", $2, driver >>"'"$FOUND"'"
 }
-/^[[:space:]]*ISAPNP: /{
+/^[<literal space><literal tab>]*ISAPNP: /{
        gsub(/=.*/, "");
        x = sprintf ("grep '\''^Card [0-9] .%s:'\'' '"$DUMP"'", $2);
        if (system (x) == 0)
@@ -434,7 +446,7 @@
 #
 # look for a descriptive device name from the given device id
 #
-function find_device_name () {
+find_device_name () {
     if expr "$1" : 
'[0-9a-f][0-9a-f][0-9a-f][0-9a-f]:[0-9a-f][0-9a-f][0-9a-f][0-9a-f]' >/dev/null; then
        /sbin/lspci -d $1 | sed -e 's/^..:..\.. Multimedia audio controller: //g'
        return
@@ -449,7 +461,7 @@
 #
 # configure and try test sound
 #
-function ac_config_card () {
+ac_config_card () {
 
     CARD_DRIVER=snd-$1
     CARD_OPTS="${*:2}"
@@ -526,9 +538,14 @@
     fi
 
     farewell "OK, driver $CARD_DRIVER is configured."
-    echo Loading driver..
+    clear
+    if [ "$distribution" = "debian" ]; then
+      echo Running update-modules...
+      update-modules
+    fi
+    echo Loading driver...
     $rcalsasound start
-    echo Setting default volumes..
+    echo Setting default volumes...
     if [ -x /usr/bin/set_default_volume ]; then
        /usr/bin/set_default_volume -f
     else
@@ -569,7 +586,7 @@
 # probe legacy ISA cards
 #
 
-function check_dma_avail () {
+check_dma_avail () {
     if [ -r /proc/dma ]; then
        list=""
        for dma in $*; do
@@ -579,7 +596,7 @@
     fi
 }
 
-function check_irq_avail () {
+check_irq_avail () {
     if [ -r /proc/interrupts ]; then
        list=""
        for irq in $*; do
@@ -591,7 +608,7 @@
 
 # check playback
 # return 0 - OK, 1 - NG, 2 - not working (irq/dma problem)
-function ac_try_load () {
+ac_try_load () {
     echo "alias char-major-116 snd
 alias snd-card-0 snd-card-$1
 options snd ${mpfx}major=116 ${mpfx}cards_limit=1
@@ -631,7 +648,7 @@
 # check capture
 # return 0 - OK, 1 - NG, 2 - not working (irq/dma problem)
 # ac_try_capture card duplex opts
-function ac_try_capture () {
+ac_try_capture () {
     echo "alias char-major-116 snd
 alias snd-card-0 snd-$1
 options snd ${mpfx}major=116 ${mpfx}cards_limit=1
@@ -674,7 +691,7 @@
     fi
 }
 
-function get_dma_pair () {
+get_dma_pair () {
     case $1 in
     0)
        echo 1 3 5;;
@@ -693,7 +710,7 @@
 # ac_try_irq card opts irqs...
 # return 0 - OK, 1 - NG, 2 - not working (dma problem?)
 #
-function ac_try_irq () {
+ac_try_irq () {
     card=$1
     opts="$2 ${mpfx}irq=$3"
     ac_try_load $card $opts >/dev/null 2>&1
@@ -724,7 +741,7 @@
 # ac_try_dmas card opts irqs...
 # return 0 - OK, 1 - NG
 #
-function ac_try_dmas () {
+ac_try_dmas () {
     dma_list=`check_dma_avail 1 0 3 5`
     for irq in ${*:3}; do
        for dma1 in $dma_list; do
@@ -760,13 +777,13 @@
 }
 
 # check if the option $2 exists in card §1: set value $3
-function ac_check_option () {
+ac_check_option () {
     if modinfo -p snd-$1 | grep $2 > /dev/null 2>&1 ; then
       echo "$2=$3"
     fi
 }
    
-function ac_try_card_sb8 () {
+ac_try_card_sb8 () {
     card=sb8
     irq_list=`check_irq_avail 5 3 9 10 7`
     for dma8 in `check_dma_avail 1 3`; do
@@ -776,7 +793,7 @@
     return 1
 }
 
-function ac_try_card_sb16 () {
+ac_try_card_sb16 () {
     card=sb16
     isapnp=`ac_check_option $card ${mpfx}isapnp 0`
     opts="$isapnp"
@@ -821,7 +838,7 @@
     return 1
 }
 
-function ac_try_card_es1688 () {
+ac_try_card_es1688 () {
     card=es1688
     opts=""
     irq_list=`check_irq_avail 5 9 10 7`
@@ -832,14 +849,14 @@
     return 1
 }
 
-function ac_try_card_es18xx () {
+ac_try_card_es18xx () {
     card=es18xx
     opts=`ac_check_option $card ${mpfx}isapnp 0`
     ac_try_dmas $card "$opts" `check_irq_avail 5 9 10 7` && return 0
     return 1
 }
 
-function ac_try_card_cs4236 () {
+ac_try_card_cs4236 () {
     card=cs4236
     irq_list=`check_irq_avail 5 7 9 11 12 15`
     isapnp=`ac_check_option $card ${mpfx}isapnp 0`
@@ -850,7 +867,7 @@
     return 1
 }
 
-function ac_try_card_cs4232 () {
+ac_try_card_cs4232 () {
     card=cs4232
     irq_list=`check_irq_avail 5 7 9 11 12 15`
     isapnp=`ac_check_option $card ${mpfx}isapnp 0`
@@ -861,7 +878,7 @@
     return 1
 }
 
-function ac_try_card_cs4231 () {
+ac_try_card_cs4231 () {
     card=cs4231
     irq_list=`check_irq_avail 5 7 9 11 12 15`
     for port in 0x530 0x534; do
@@ -871,7 +888,7 @@
     return 1
 }
 
-function ac_try_card_opl3sa2 () {
+ac_try_card_opl3sa2 () {
     card=opl3sa2
     irq_list=`check_irq_avail 5 9 3 1 11 12 15 0`
     isapnp=`ac_check_option $card ${mpfx}isapnp 0`
@@ -884,7 +901,7 @@
     return 1
 }
 
-function ac_config_legacy () {
+ac_config_legacy () {
 
     $DIALOG --title "WARNING" --yesno "
    Probing legacy ISA cards might make
#! /bin/sh -e

# 06_isa_build.dpatch by Steve Kowalik
#
# DP: Don't build ISA sound modules if CONFIG_ISA is n.

. debian/patches/patch-opts

if [ $# -ne 1 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi
case "$1" in
    -patch) patch $patch_opts < $0;;
    -unpatch) patch $patch_opts -R < $0;;
    *)
        echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
        exit 1;;
esac

exit 0

--- alsa-driver/Makefile~       2003-02-06 23:00:11.000000000 +1100
+++ alsa-driver/Makefile        2003-02-06 23:00:48.000000000 +1100
@@ -37,7 +37,7 @@
 endif
 endif
 
-SUBDIRS  += acore i2c drivers isa synth
+SUBDIRS  += acore i2c drivers synth
 ifeq (y,$(CONFIG_PCI))
 SUBDIRS  += pci
 endif
@@ -56,6 +56,9 @@
 ifeq (y,$(CONFIG_PCMCIA))
 SUBDIRS  += pcmcia
 endif
+ifeq (y,$(CONFIG_ISA))
+SUBDIRS  += isa
+endif
 CSUBDIRS += include test utils
 
 .PHONY: all

Attachment: msg06355/pgp00000.pgp
Description: PGP signature

Reply via email to