mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-12-22 21:56:31 +01:00
- use /etc/modprobe.d/sound config file if possible.
This commit is contained in:
parent
1ef970a295
commit
29fd44ba35
1 changed files with 51 additions and 17 deletions
|
@ -151,7 +151,15 @@ case `uname -r` in
|
|||
;;
|
||||
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"
|
||||
|
@ -530,6 +538,20 @@ find_device_name () {
|
|||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# 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
|
||||
#
|
||||
|
@ -538,10 +560,15 @@ ac_config_card () {
|
|||
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 @@ Do you want to modify ${cfgfile}?" 8 50 || acex 0
|
|||
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-0 snd-mixer-oss
|
|||
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)
|
||||
|
|
Loading…
Reference in a new issue