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

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


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

Modified: alsaconf/alsaconf.in alsactl/alsactl.1 alsactl/alsactl.c
          debian/patches/91_debian_alsaconf_noclear.dpatch

Reduce footprint of 91_debian_alsaconf_noclear


--------------------------------------------------+
 alsaconf/alsaconf.in                             |   65 +++++++--------------
 alsactl/alsactl.1                                |    4 -
 alsactl/alsactl.c                                |    2 
 debian/patches/91_debian_alsaconf_noclear.dpatch |   39 ------------
 4 files changed, 27 insertions(+), 83 deletions(-)


Index: debian/alsa-utils/alsaconf/alsaconf.in
diff -u debian/alsa-utils/alsaconf/alsaconf.in:1.6 debian/alsa-utils/alsaconf/alsaconf.in:1.7
--- debian/alsa-utils/alsaconf/alsaconf.in:1.6	Mon Sep  6 15:07:40 2004
+++ debian/alsa-utils/alsaconf/alsaconf.in	Tue Sep  7 02:02:55 2004
@@ -40,13 +40,6 @@
   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]"
@@ -74,8 +67,8 @@
 use_modinfo_db=0
 do_logging=0
 alsa_uid=0
-alsa_gid=0
-alsa_mode=0666
+alsa_gid=29
+alsa_mode=0660
 legacy_probe_card=""
 LOGFILE="/tmp/alsaconf.log"
 TESTSOUND="@TESTSOUND@"
@@ -161,12 +154,9 @@
   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/alsa/modutils/0.9"
+  cfgfile="/etc/modutils/alsa-base"
 elif [ -e /etc/modules.conf ]; then
   cfgfile="/etc/modules.conf"
 elif [ -e /etc/conf.modules ]; then
@@ -501,7 +491,7 @@
 /^[<literal space><literal tab>]*PCI: /{
 	gsub(/0x/, "");
 	gsub(/=/, ":");
-	x = sprintf ("'$lspci' -n 2>/dev/null| grep '"'Class 0401'"' | grep %s", $2);
+	x = sprintf ("'/usr/bin/lspci' -n | grep '"' 0401: '"' | grep %s", $2);
 	if (system (x) == 0)
 		printf "%s %s\n", $2, driver >>"'"$FOUND"'"
 }
@@ -532,7 +522,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
-	$lspci -d $1 2>/dev/null| sed -e 's/^.*:..\.. Multimedia audio controller: //g'
+	/usr/bin/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/'`
@@ -543,20 +533,6 @@
 }
 
 #
-# 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 () {
@@ -589,16 +565,17 @@
 	SOUND_CORE="snd"
     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
+    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
     fi
 
     if [ -n "$cfgout" ]; then
-	rm -f "$cfgout"
-	touch "$cfgout"
 	addcfg="$cfgout"
+	: > "$addcfg"
     else
 	addcfg="$TMP"
 	echo "$ACB
@@ -633,9 +610,11 @@
     fi
 
     if [ -n "$cfgout" ]; then
-	backup_old_config $cfgfile $TMP
+	[ ! -r "$cfgfile" ] || cmp -s "$TMP" "$cfgfile" || cat "$TMP" > "$cfgfile"
+	rm -f "$TMP"
     else
-	backup_old_config $cfgfile $addcfg
+        cmp -s "$addcfg" "$cfgfile" || cat "$addcfg" > "$cfgfile"
+	rm -f "$addcfg"
     fi
 
     /sbin/depmod -a 2>/dev/null
@@ -684,8 +663,8 @@
 	  aplay $TESTSOUND
       fi
     fi
-    if [ ! -r /etc/asound.state ]; then
-	echo "Saving the mixer setup used for this in /etc/asound.state."
+    if [ ! -r /var/lib/alsa/asound.state ]; then
+	echo "Saving the mixer setup used for this in /var/lib/alsa/asound.state."
 	$sbindir/alsactl store
     fi
     clear
@@ -730,7 +709,7 @@
 ac_try_load () {
     test $do_logging = 1 && echo "$1 ${*:2}" >> $LOGFILE
     /sbin/modprobe snd-$1 ${*:2} >/dev/null 2>&1
-    if $lsmod | grep -E '^(snd-|snd_)'$1' ' >/dev/null 2>&1; then
+    if /bin/lsmod | grep -E '^(snd-|snd_)'$1' ' >/dev/null 2>&1; then
 	: ;
     else
 	modprobe -r snd-$1 >/dev/null 2>&1
@@ -769,7 +748,7 @@
 ac_try_capture () {
     test $do_logging = 1 && echo "$1 ${*:2}" >> $LOGFILE
     /sbin/modprobe snd-$1 ${*:3} >/dev/null 2>&1
-    if $lsmod | grep -E '^(snd-|snd_)'$1' ' >/dev/null 2>&1; then
+    if /bin/lsmod | grep -E '^(snd-|snd_)'$1' ' >/dev/null 2>&1; then
 	: ;
     else
 	modprobe -r snd-$1 >/dev/null 2>&1
@@ -1125,7 +1104,7 @@
     # check for TP600E
     #
     if [ ${devs_found[0]} = cs46xx ]; then
-	if $lspci -nv 2>/dev/null| grep -q "Subsystem: 1014:1010"; then
+	if /usr/bin/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
@@ -1138,7 +1117,7 @@
 		ac_config_legacy cs4236
 		exit 0
 	    fi
-	elif $lspci -nv 2>/dev/null| grep -q "Subsystem: 8086:8080"; then
+	elif /usr/bin/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.3 debian/alsa-utils/alsactl/alsactl.1:1.4
--- debian/alsa-utils/alsactl/alsactl.1:1.3	Mon Sep  6 06:33:46 2004
+++ debian/alsa-utils/alsactl/alsactl.1	Tue Sep  7 02:02:55 2004
@@ -34,7 +34,7 @@
 
 .TP
 \fI-f, --file\fP
-Select the configuration file to use. The default is /etc/asound.state
+Select the configuration file to use. The default is /var/lib/alsa/asound.state
 
 .TP
 \fI-F, --force\fP
@@ -50,7 +50,7 @@
 Print alsactl version number.
 
 .SH FILES
-\fI/etc/asound.state\fP (or whatever file you specify with the
+\fI/var/lib/alsa/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.3 debian/alsa-utils/alsactl/alsactl.c:1.4
--- debian/alsa-utils/alsactl/alsactl.c:1.3	Mon Sep  6 06:33:46 2004
+++ debian/alsa-utils/alsactl/alsactl.c	Tue Sep  7 02:02:55 2004
@@ -29,7 +29,7 @@
 #include <errno.h>
 #include <alsa/asoundlib.h>
 
-#define SYS_ASOUNDRC "/etc/asound.state"
+#define SYS_ASOUNDRC "/var/lib/alsa/asound.state"
 
 int debugflag = 0;
 int force_restore = 0;
Index: debian/alsa-utils/debian/patches/91_debian_alsaconf_noclear.dpatch
diff -u debian/alsa-utils/debian/patches/91_debian_alsaconf_noclear.dpatch:1.2 debian/alsa-utils/debian/patches/91_debian_alsaconf_noclear.dpatch:1.3
--- debian/alsa-utils/debian/patches/91_debian_alsaconf_noclear.dpatch:1.2	Tue Sep  7 00:59:14 2004
+++ debian/alsa-utils/debian/patches/91_debian_alsaconf_noclear.dpatch	Tue Sep  7 02:02:55 2004
@@ -23,15 +23,15 @@
 exit 0
 
 @DPATCH@
-diff -urNad /home/jdthood/src/pkg-alsa/debian/alsa-utils/alsaconf/alsaconf.in alsa-utils/alsaconf/alsaconf.in
---- /home/jdthood/src/pkg-alsa/debian/alsa-utils/alsaconf/alsaconf.in	2004-09-07 08:54:07.000000000 +0200
-+++ alsa-utils/alsaconf/alsaconf.in	2004-09-07 08:58:43.000000000 +0200
+diff -urNad /home/jdthood/src/pkg-alsa_NEWER/debian/alsa-utils/alsaconf/alsaconf.in alsa-utils/alsaconf/alsaconf.in
+--- /home/jdthood/src/pkg-alsa_NEWER/debian/alsa-utils/alsaconf/alsaconf.in	2004-09-07 10:02:58.000000000 +0200
++++ alsa-utils/alsaconf/alsaconf.in	2004-09-07 10:03:32.000000000 +0200
 @@ -317,10 +317,20 @@
  " 17 60 || acex 0
  }
  
-+clearscreen() {
-+    # Do a clear here if you prefer
++clear() {
++    # Do a real clear here if you prefer
 +    echo
 +}
 +
@@ -40,47 +40,11 @@
    cleanup
 -  clear
 +  if [ "$1" = 0 ] ; then
-+      clearscreen
++      clear
 +  else
 +      # Don't clear error messages
 +      echo
 +  fi
    exit $1
  }
- 
-@@ -549,7 +559,7 @@
-     $DIALOG --yesno "
- Configuring $CARD_DRIVER
- Do you want to modify ${addcfg}?" 8 50 || acex 0
--    clear
-+    clearscreen
- 
-     # Copy conf.modules and make changes.
-     ACB="# --- BEGIN: Generated by ALSACONF, do not edit. ---"
-@@ -631,7 +641,7 @@
-     fi
- 
-     farewell "OK, driver $CARD_DRIVER is configured."
--    clear
-+    clearscreen
-     if [ "$distribution" = "gentoo" ]; then
-       echo Running modules-update...
-       modules-update
-@@ -658,7 +668,7 @@
-           and look if you can hear test sound.
- " 13 65 
-       then
--          clear
-+          clearscreen
- 	  echo
- 	  aplay $TESTSOUND
-       fi
-@@ -667,7 +677,7 @@
- 	echo "Saving the mixer setup used for this in /var/lib/alsa/asound.state."
- 	$sbindir/alsactl store
-     fi
--    clear
-+    clearscreen
-     cat <<END
- ===============================================================================