Skip to contentSkip to conversation

let alsaconf work on all distros

PATCH Applied Thierry Vignaud 2 participants 2 messages Sep 8, 2003 – Sep 9, 2003

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 let alsaconf work on all distros

on mandrake, lspci is in /usr/bin, not /bin.

the following patch make alsaconf search for lspci location and factorize binary location with lsmod btw:

alsaconf renamed from alsaconf.tv +9 -8
@@ -36,11 +36,12 @@
   distribution="unknown"
 fi
 
-if [ -x /sbin/lsmod ]; then
-  lsmod=/sbin/lsmod
-else
-  lsmod=/bin/lsmod
-fi
+for prog in lspci lsmod; do
+	for path in /sbin /usr/sbin /bin /usr/bin;do
+		[[ -x $path/$prog ]] && eval $prog=$path/$prog
+	done
+done
+unset prog path
 
 usage() {
     echo "ALSA configurator version $version"
@@ -438,7 +439,7 @@
 /^[<literal space><literal tab>]*PCI: /{
 	gsub(/0x/, "");
 	gsub(/=/, ":");
-	x = sprintf ("/sbin/lspci -n | grep '"'Class 0401'"' | grep %s", $2);
+	x = sprintf ("'$lspci' -n | grep '"'Class 0401'"' | grep %s", $2);
 	if (system (x) == 0)
 		printf "%s %s\n", $2, driver >>"'"$FOUND"'"
 }
@@ -468,7 +469,7 @@
 #
 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'
+	$lspci -d $1 | sed -e 's/^..:..\.. Multimedia audio controller: //g'
 	return
     elif expr "$1" : '[A-Z@][A-Z@][A-Z@][0-9a-f][0-9a-f][0-9a-f][0-9a-f]' >/dev/null; then
 	cardname=`grep '^Card [0-9]\+ '\'$1':' $DUMP | head -n 1 | sed -e 's/^Card [0-9]\+ '\''.*:\(.*\)'\'' .*$/\1/'`
@@ -1026,7 +1027,7 @@
     # check for TP600E
     #
     if [ ${devs_found[0]} = cs46xx ]; then
-	if /sbin/lspci -nv | grep -q "Subsystem: 1014:1010"; then
+	if $lspci -nv | grep -q "Subsystem: 1014:1010"; then
 	    if $DIALOG --yesno "
  Looks like you having a Thinkpad 600E notebook.
  On this notebook, CS4236 driver should be used
Applied
#1 lore raw

At Mon, 08 Sep 2003 16:58:08 +0200,

Quoted 6 lines · Thierry Vignaud

[1 <text/plain (7bit)>]
on mandrake, lspci is in /usr/bin, not /bin.

the following patch make alsaconf search for lspci location and factorize binary location with lsmod btw:

thanks, applied now.

Takashi

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf