slitaz-boot-scripts rev 377

system.sh: start sound config later and sleep before restore to let the kernel init the sound card)
author Christophe Lincoln <pankso@slitaz.org>
date Fri Jul 11 11:49:35 2014 +0200 (2014-07-11)
parents 5141d4636e49
children 0e9e08cd6665
files etc/init.d/system.sh
line diff
     1.1 --- a/etc/init.d/system.sh	Mon Jun 16 11:28:39 2014 +0200
     1.2 +++ b/etc/init.d/system.sh	Fri Jul 11 11:49:35 2014 +0200
     1.3 @@ -26,46 +26,6 @@
     1.4  	esac
     1.5  done
     1.6  
     1.7 -# Sound configuration stuff. First check if sound=no and remove all
     1.8 -# sound Kernel modules.
     1.9 -if [ -n "$DRIVER" ]; then
    1.10 -	case "$DRIVER" in
    1.11 -		no)
    1.12 -			echo -n "Removing all sound kernel modules..."
    1.13 -			rm -rf /lib/modules/$(uname -r)/kernel/sound
    1.14 -			status
    1.15 -			echo -n "Removing all sound packages..."
    1.16 -			for i in $(grep -l '^DEPENDS=.*alsa-lib' /var/lib/tazpkg/installed/*/receipt) ; do
    1.17 -				pkg=${i#/var/lib/tazpkg/installed/}
    1.18 -				echo 'y' | tazpkg remove ${pkg%/*} > /dev/null
    1.19 -			done
    1.20 -			for i in alsa-lib mhwaveedit asunder libcddb ; do
    1.21 -				echo 'y' | tazpkg remove $i > /dev/null
    1.22 -			done
    1.23 -			status ;;
    1.24 -		noconf)
    1.25 -			echo "Sound configuration was disabled from cmdline..." ;;
    1.26 -		*)
    1.27 -			if [ -x /usr/sbin/soundconf ]; then
    1.28 -				echo "Using sound kernel module $DRIVER..."
    1.29 -				/usr/sbin/soundconf -M $DRIVER
    1.30 -			fi ;;
    1.31 -	esac
    1.32 -# Sound card may already be detected by kernel/udev
    1.33 -elif [ -d /proc/asound ]; then
    1.34 -	# Restore sound config for installed system
    1.35 -	if [ -s /var/lib/alsa/asound.state ]; then
    1.36 -		echo -n "Restoring last alsa configuration..."
    1.37 -		alsactl restore
    1.38 -		status
    1.39 -	else
    1.40 -		# Initialize sound card
    1.41 -		alsactl init
    1.42 -	fi
    1.43 -else
    1.44 -	echo "Unable to configure sound card."
    1.45 -fi
    1.46 -
    1.47  # Locale config
    1.48  if [ ! -s "/etc/locale.conf" ]; then
    1.49  	echo "Setting system locale to: POSIX (English)"
    1.50 @@ -120,3 +80,42 @@
    1.51  
    1.52  # Kernel polling for automount
    1.53  echo 5000 > /sys/module/block/parameters/events_dfl_poll_msecs 2>/dev/null
    1.54 +
    1.55 +# Sound configuration stuff. First check if sound=no and remove all
    1.56 +# sound Kernel modules.
    1.57 +if [ -n "$DRIVER" ]; then
    1.58 +	case "$DRIVER" in
    1.59 +		no)
    1.60 +			echo -n "Removing all sound kernel modules..."
    1.61 +			rm -rf /lib/modules/$(uname -r)/kernel/sound
    1.62 +			status
    1.63 +			echo -n "Removing all sound packages..."
    1.64 +			for i in $(grep -l '^DEPENDS=.*alsa-lib' /var/lib/tazpkg/installed/*/receipt) ; do
    1.65 +				pkg=${i#/var/lib/tazpkg/installed/}
    1.66 +				echo 'y' | tazpkg remove ${pkg%/*} > /dev/null
    1.67 +			done
    1.68 +			for i in alsa-lib mhwaveedit asunder libcddb ; do
    1.69 +				echo 'y' | tazpkg remove $i > /dev/null
    1.70 +			done
    1.71 +			status ;;
    1.72 +		noconf)
    1.73 +			echo "Sound configuration was disabled from cmdline..." ;;
    1.74 +		*)
    1.75 +			if [ -x /usr/sbin/soundconf ]; then
    1.76 +				echo "Using sound kernel module $DRIVER..."
    1.77 +				/usr/sbin/soundconf -M $DRIVER
    1.78 +			fi ;;
    1.79 +	esac
    1.80 +# Sound card may already be detected by kernel/udev
    1.81 +elif [ -d /proc/asound ]; then
    1.82 +	if [ -s /var/lib/alsa/asound.state ]; then
    1.83 +		# Restore sound config for installed system
    1.84 +		echo "Restoring last alsa configuration..."
    1.85 +		(sleep 2; alsactl restore) &
    1.86 +	else
    1.87 +		# Initialize sound card
    1.88 +		alsactl init
    1.89 +	fi
    1.90 +else
    1.91 +	echo "WARNING: Unable to configure sound card"
    1.92 +fi