slitaz-boot-scripts rev 42

Cmdline: sound=<driver> support
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Mar 05 09:27:30 2008 +0000 (2008-03-05)
parents 15b59bbf70c4
children 46f1b3ef0c8b
files etc/init.d/hwconf.sh
line diff
     1.1 --- a/etc/init.d/hwconf.sh	Sat Mar 01 12:11:15 2008 +0000
     1.2 +++ b/etc/init.d/hwconf.sh	Wed Mar 05 09:27:30 2008 +0000
     1.3 @@ -6,33 +6,35 @@
     1.4  # Sound configuration stuff. First check if sound=no and remoce all sound
     1.5  # Kernel modules.
     1.6  #
     1.7 -if grep -q -w "sound=no" /proc/cmdline; then
     1.8 -	echo -n "Removing all sound kernel modules..."
     1.9 -	rm -rf /lib/modules/`uname -r`/kernel/sound
    1.10 -	status
    1.11 -	echo -n "Removing all sound packages..."
    1.12 -	for i in $(grep -l '^DEPENDS=.*alsa-lib' /var/lib/tazpkg/installed/*/receipt) ; do
    1.13 -		pkg=${i#/var/lib/tazpkg/installed/}
    1.14 -		echo 'y' | tazpkg remove ${pkg%/*} > /dev/null
    1.15 -	done
    1.16 -	echo 'y' | tazpkg remove alsa-lib > /dev/null
    1.17 -	status
    1.18 -else
    1.19 -	# Config or not config
    1.20 -	if grep -q -w "sound=noconf" /proc/cmdline; then
    1.21 -		echo "Sound configuration is disable from cmdline..."
    1.22 -	elif [ ! -f /var/lib/sound-card-driver ]; then
    1.23 -		if [ -f /usr/sbin/soundconf ]; then
    1.24 -			# Start soundconf to config driver and load module for Live mode
    1.25 -			/usr/sbin/soundconf
    1.26 -		else
    1.27 -			echo "Unable to found: /usr/sbin/soundconf"
    1.28 -		fi
    1.29 +if grep -q -w "sound=" /proc/cmdline; then
    1.30 +	DRIVER=`cat /proc/cmdline | sed 's/.*sound=\([^ ]*\).*/\1/'`
    1.31 +	case "$DRIVER" in
    1.32 +	no)
    1.33 +		echo -n "Removing all sound kernel modules..."
    1.34 +		rm -rf /lib/modules/`uname -r`/kernel/sound
    1.35 +		status
    1.36 +		echo -n "Removing all sound packages..."
    1.37 +		for i in $(grep -l '^DEPENDS=.*alsa-lib' /var/lib/tazpkg/installed/*/receipt) ; do
    1.38 +			pkg=${i#/var/lib/tazpkg/installed/}
    1.39 +			echo 'y' | tazpkg remove ${pkg%/*} > /dev/null
    1.40 +		done
    1.41 +		echo 'y' | tazpkg remove alsa-lib > /dev/null
    1.42 +		status;;
    1.43 +	noconf)
    1.44 +		echo "Sound configuration is disable from cmdline...";;
    1.45 +	*)
    1.46 +		echo "Using sound kernel module $DRIVER...";;
    1.47 +		echo "snd-$DRIVER" > /var/lib/sound-card-driver;;
    1.48 +	esac
    1.49 +elif [ ! -f /var/lib/sound-card-driver ]; then
    1.50 +	if [ -f /usr/sbin/soundconf ]; then
    1.51 +		# Start soundconf to config driver and load module for Live mode
    1.52 +		/usr/sbin/soundconf
    1.53  	else
    1.54 -		# /var/lib/sound-card-driver exist so sound is already configured.
    1.55 -		continue
    1.56 +		echo "Unable to found: /usr/sbin/soundconf"
    1.57  	fi
    1.58  fi
    1.59 +
    1.60  # Restore sound config for installed system.
    1.61  if [ -f /var/lib/sound-card-driver ]; then
    1.62  	echo -n "Restoring last alsa configuration..."