Update of /cvsroot/alsa/alsa-utils/alsaconf
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv770/alsaconf

Modified Files:
        alsaconf.in 
Log Message:
- use /etc/modprobe.d/sound config file if possible.






Index: alsaconf.in
===================================================================
RCS file: /cvsroot/alsa/alsa-utils/alsaconf/alsaconf.in,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- alsaconf.in 16 Feb 2004 16:44:59 -0000      1.12
+++ alsaconf.in 25 Feb 2004 14:39:45 -0000      1.13
@@ -151,7 +151,15 @@
   ;;
 esac
 
-if [ "$kernel" = "new" -a -f /etc/modprobe.conf ]; then
+# cfgfile = base config file to remove/update the sound setting
+# cfgout = new config file to write the sound setting (if different from $cfgfile)
+if [ "$kernel" = "new" ]; then
+  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"
@@ -531,6 +539,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 () {
@@ -538,10 +560,15 @@
     CARD_DRIVER=snd-$1
     CARD_OPTS="${*:2}"
 
+    if [ -n "$cfgout" ]; then
+       addcfg="$cfgout"
+    else
+       addcfg="$cfgfile"
+    fi
     # Configuration done
     $DIALOG --yesno "
 Configuring $CARD_DRIVER
-Do you want to modify ${cfgfile}?" 8 50 || acex 0
+Do you want to modify ${addcfg}?" 8 50 || acex 0
     clear
 
     # Copy conf.modules and make changes.
@@ -563,8 +590,17 @@
     else
        remove_ac_block < $cfgfile | remove_y2_block | uniq > $TMP
     fi
-    echo "$ACB
-# --- ALSACONF verion $version ---" >> $TMP
+
+    if [ -n "$cfgout" ]; then
+       rm -f "$cfgout"
+       touch "$cfgout"
+       addcfg="$cfgout"
+    else
+       addcfg="$TMP"
+       echo "$ACB
+# --- ALSACONF verion $version ---" >> $addcfg
+    fi
+
     if [ -z "$have_alias" -a "$kernel" = "new" ]; then
        if grep -q char-major-116 /lib/modules/`uname -r`/modules.alias; then
            have_alias="yes"
@@ -577,29 +613,27 @@
 alias sound-service-0-1 snd-seq-oss
 alias sound-service-0-3 snd-pcm-oss
 alias sound-service-0-8 snd-seq-oss
-alias sound-service-0-12 snd-pcm-oss" >> $TMP
+alias sound-service-0-12 snd-pcm-oss" >> $addcfg
     fi
     if [ -n "$alsa_device_opts" ]; then
-       echo "options snd $alsa_device_opts" >> $TMP
+       echo "options snd $alsa_device_opts" >> $addcfg
     fi
 echo "alias snd-card-0 $CARD_DRIVER
-alias sound-slot-0 $CARD_DRIVER" >> $TMP
+alias sound-slot-0 $CARD_DRIVER" >> $addcfg
     if [ -n "$CARD_OPTS" ]; then
-       echo "options $CARD_DRIVER $CARD_OPTS" >> $TMP
+       echo "options $CARD_DRIVER $CARD_OPTS" >> $addcfg
+    fi
+    if [ -z "$cfgout" ]; then
+       echo "$ACE
+" >> $addcfg
     fi
-echo "$ACE
-" >> $TMP
 
-    if cp -f $cfgfile $cfgfile.old; then
-       :
+    if [ -n "$cfgout" ]; then
+       backup_old_config $cfgfile $TMP
     else
-       echo "ERROR! $cfgfile could not be saved."
-       echo "Configured ALSA is in /tmp/alsaconf.saved."
-       cp $TMP /tmp/alsaconf.saved
-       exit 1
+       backup_old_config $cfgfile $addcfg
     fi
 
-    cp -f $TMP $cfgfile
     /sbin/depmod -a 2>/dev/null
 
     # remove yast2 entries (- only for suse distro)



-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog

Reply via email to