[Pkg-alsa-devel] [Debian ALSA CVS] debian/alsa-utils (3 files)

Thomas Hood jdthood-guest@haydn.debian.org
Tue, 07 Sep 2004 02:04:01 -0600


    Date: Tuesday, September 7, 2004 @ 02:04:01
  Author: jdthood-guest
    Path: /cvsroot/pkg-alsa/debian/alsa-utils

Modified: alsaconf/alsaconf.in alsactl/alsactl.1 alsactl/alsactl.c

dpatch deapply-all


----------------------+
 alsaconf/alsaconf.in |   65 ++++++++++++++++++++++++++++++++-----------------
 alsactl/alsactl.1    |    4 +--
 alsactl/alsactl.c    |    2 -
 3 files changed, 46 insertions(+), 25 deletions(-)


Index: debian/alsa-utils/alsaconf/alsaconf.in
diff -u debian/alsa-utils/alsaconf/alsaconf.in:1.7 debian/alsa-utils/alsaconf/alsaconf.in:1.8
--- debian/alsa-utils/alsaconf/alsaconf.in:1.7	Tue Sep  7 02:02:55 2004
+++ debian/alsa-utils/alsaconf/alsaconf.in	Tue Sep  7 02:03:59 2004
@@ -40,6 +40,13 @@
   distribution="unknown"
 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"
     echo "usage: alsaconf [options]"
@@ -67,8 +74,8 @@
 use_modinfo_db=0
 do_logging=0
 alsa_uid=0
-alsa_gid=29
-alsa_mode=0660
+alsa_gid=0
+alsa_mode=0666
 legacy_probe_card=""
 LOGFILE="/tmp/alsaconf.log"
 TESTSOUND="@TESTSOUND@"
@@ -154,9 +161,12 @@
   if [ -d /etc/modprobe.d ]; then
     cfgout="/etc/modprobe.d/sound"
   fi
+  if [ ! -r /etc/modprobe.conf ]; then
+    touch /etc/modprobe.conf
+  fi
   cfgfile="/etc/modprobe.conf"
 elif [ "$distribution" = "debian" ]; then
-  cfgfile="/etc/modutils/alsa-base"
+  cfgfile="/etc/alsa/modutils/0.9"
 elif [ -e /etc/modules.conf ]; then
   cfgfile="/etc/modules.conf"
 elif [ -e /etc/conf.modules ]; then
@@ -491,7 +501,7 @@
 /^[<literal space><literal tab>]*PCI: /{
 	gsub(/0x/, "");
 	gsub(/=/, ":");
-	x = sprintf ("'/usr/bin/lspci' -n | grep '"' 0401: '"' | grep %s", $2);
+	x = sprintf ("'$lspci' -n 2>/dev/null| grep '"'Class 0401'"' | grep %s", $2);
 	if (system (x) == 0)
 		printf "%s %s\n", $2, driver >>"'"$FOUND"'"
 }
@@ -522,7 +532,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
-	/usr/bin/lspci -d $1 2>/dev/null| sed -e 's/^.*:..\.. Multimedia audio controller: //g'
+	$lspci -d $1 2>/dev/null| 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/'`
@@ -533,6 +543,20 @@
 }
 
 #
+# make a backup of old config
+backup_old_config () {
+    if cmp -s $1 $2; then
+	return
+    fi
+    if cp -f $1 $1.old; then
+	cp -f $2 $1
+    else
+	echo "ERROR! $1 could not be saved."
+	exit 1
+    fi
+}
+
+#
 # configure and try test sound
 #
 ac_config_card () {
@@ -565,17 +589,16 @@
 	SOUND_CORE="snd"
     fi
 
-    if [ -r $cfgfile ] ; then
-        if [ "$distribution" = "redhat" -o "$distribution" = "fedora" ] ; then
-            remove_ac_block < $cfgfile | remove_sndconfig_block | uniq > $TMP
-        else
-	    remove_ac_block < $cfgfile | remove_y2_block | uniq > $TMP
-        fi
+    if [ "$distribution" = "redhat" -o "$distribution" = "fedora" ] ; then
+        remove_ac_block < $cfgfile | remove_sndconfig_block | uniq > $TMP
+    else
+	remove_ac_block < $cfgfile | remove_y2_block | uniq > $TMP
     fi
 
     if [ -n "$cfgout" ]; then
+	rm -f "$cfgout"
+	touch "$cfgout"
 	addcfg="$cfgout"
-	: > "$addcfg"
     else
 	addcfg="$TMP"
 	echo "$ACB
@@ -610,11 +633,9 @@
     fi
 
     if [ -n "$cfgout" ]; then
-	[ ! -r "$cfgfile" ] || cmp -s "$TMP" "$cfgfile" || cat "$TMP" > "$cfgfile"
-	rm -f "$TMP"
+	backup_old_config $cfgfile $TMP
     else
-        cmp -s "$addcfg" "$cfgfile" || cat "$addcfg" > "$cfgfile"
-	rm -f "$addcfg"
+	backup_old_config $cfgfile $addcfg
     fi
 
     /sbin/depmod -a 2>/dev/null
@@ -663,8 +684,8 @@
 	  aplay $TESTSOUND
       fi
     fi
-    if [ ! -r /var/lib/alsa/asound.state ]; then
-	echo "Saving the mixer setup used for this in /var/lib/alsa/asound.state."
+    if [ ! -r /etc/asound.state ]; then
+	echo "Saving the mixer setup used for this in /etc/asound.state."
 	$sbindir/alsactl store
     fi
     clear
@@ -709,7 +730,7 @@
 ac_try_load () {
     test $do_logging = 1 && echo "$1 ${*:2}" >> $LOGFILE
     /sbin/modprobe snd-$1 ${*:2} >/dev/null 2>&1
-    if /bin/lsmod | grep -E '^(snd-|snd_)'$1' ' >/dev/null 2>&1; then
+    if $lsmod | grep -E '^(snd-|snd_)'$1' ' >/dev/null 2>&1; then
 	: ;
     else
 	modprobe -r snd-$1 >/dev/null 2>&1
@@ -748,7 +769,7 @@
 ac_try_capture () {
     test $do_logging = 1 && echo "$1 ${*:2}" >> $LOGFILE
     /sbin/modprobe snd-$1 ${*:3} >/dev/null 2>&1
-    if /bin/lsmod | grep -E '^(snd-|snd_)'$1' ' >/dev/null 2>&1; then
+    if $lsmod | grep -E '^(snd-|snd_)'$1' ' >/dev/null 2>&1; then
 	: ;
     else
 	modprobe -r snd-$1 >/dev/null 2>&1
@@ -1104,7 +1125,7 @@
     # check for TP600E
     #
     if [ ${devs_found[0]} = cs46xx ]; then
-	if /usr/bin/lspci -nv 2>/dev/null| grep -q "Subsystem: 1014:1010"; then
+	if $lspci -nv 2>/dev/null| grep -q "Subsystem: 1014:1010"; then
 	    if $DIALOG --yesno "
  Looks like you having a Thinkpad 600E or 770 notebook.
  On this notebook, CS4236 driver should be used
@@ -1117,7 +1138,7 @@
 		ac_config_legacy cs4236
 		exit 0
 	    fi
-	elif /usr/bin/lspci -nv 2>/dev/null| grep -q "Subsystem: 8086:8080"; then
+	elif $lspci -nv 2>/dev/null| grep -q "Subsystem: 8086:8080"; then
 	    if $DIALOG --yesno "
  Looks like you having a Dell Dimension machine.
  On this machine, CS4232 driver should be used
Index: debian/alsa-utils/alsactl/alsactl.1
diff -u debian/alsa-utils/alsactl/alsactl.1:1.4 debian/alsa-utils/alsactl/alsactl.1:1.5
--- debian/alsa-utils/alsactl/alsactl.1:1.4	Tue Sep  7 02:02:55 2004
+++ debian/alsa-utils/alsactl/alsactl.1	Tue Sep  7 02:03:59 2004
@@ -34,7 +34,7 @@
 
 .TP
 \fI-f, --file\fP
-Select the configuration file to use. The default is /var/lib/alsa/asound.state
+Select the configuration file to use. The default is /etc/asound.state
 
 .TP
 \fI-F, --force\fP
@@ -50,7 +50,7 @@
 Print alsactl version number.
 
 .SH FILES
-\fI/var/lib/alsa/asound.state\fP (or whatever file you specify with the
+\fI/etc/asound.state\fP (or whatever file you specify with the
 \fB-f\fP flag) is used to store current settings for your
 soundcards. The settings include all the usual soundcard mixer
 settings.  More importantly, alsactl is
Index: debian/alsa-utils/alsactl/alsactl.c
diff -u debian/alsa-utils/alsactl/alsactl.c:1.4 debian/alsa-utils/alsactl/alsactl.c:1.5
--- debian/alsa-utils/alsactl/alsactl.c:1.4	Tue Sep  7 02:02:55 2004
+++ debian/alsa-utils/alsactl/alsactl.c	Tue Sep  7 02:03:59 2004
@@ -29,7 +29,7 @@
 #include <errno.h>
 #include <alsa/asoundlib.h>
 
-#define SYS_ASOUNDRC "/var/lib/alsa/asound.state"
+#define SYS_ASOUNDRC "/etc/asound.state"
 
 int debugflag = 0;
 int force_restore = 0;