slitaz-boot-scripts rev 170

hwconf.sh: Add screen=auto option to autodetect screen resolution
author Christophe Lincoln <pankso@slitaz.org>
date Mon Apr 27 15:57:21 2009 +0200 (2009-04-27)
parents 052f4f60ee36
children c7c3f5408ff7
files etc/init.d/hwconf.sh
line diff
     1.1 --- a/etc/init.d/hwconf.sh	Mon Apr 27 15:48:38 2009 +0200
     1.2 +++ b/etc/init.d/hwconf.sh	Mon Apr 27 15:57:21 2009 +0200
     1.3 @@ -72,16 +72,25 @@
     1.4  		sed -i "s|-screen|$XARG -screen|" /etc/slim.conf
     1.5  	fi
     1.6  	if [ -n "$SCREEN" ]; then
     1.7 -		export NEW_SCREEN=$SCREEN
     1.8 -		if [ "$NEW_SCREEN" = "text" ]; then
     1.9 -			echo -n "Disabling X login manager: slim..."
    1.10 -			. /etc/rcS.conf
    1.11 -			RUN_DAEMONS=`echo $RUN_DAEMONS | sed s/' slim'/''/`
    1.12 -			sed -i s/"RUN_DAEMONS.*"/"RUN_DAEMONS=\"$RUN_DAEMONS\"/" /etc/rcS.conf
    1.13 -			status
    1.14 -		else
    1.15 -			tazx `cat /etc/X11/wm.default`
    1.16 -		fi
    1.17 +		case "$SCREEN" in
    1.18 +			text)
    1.19 +				# Disable X.
    1.20 +				echo -n "Disabling X login manager: slim..."
    1.21 +				. /etc/rcS.conf
    1.22 +				RUN_DAEMONS=`echo $RUN_DAEMONS | sed s/' slim'/''/`
    1.23 +				sed -i s/"RUN_DAEMONS.*"/"RUN_DAEMONS=\"$RUN_DAEMONS\"/" /etc/rcS.conf
    1.24 +				status ;;
    1.25 +			auto)
    1.26 +				# Auto detect screen resolution.
    1.27 +				export NEW_SCREEN=`Xvesa -listmodes 2>&1 | grep ^0x | \
    1.28 +					awk '{ printf "%s %s\n",$2 }' \
    1.29 +					| sort -nr | grep x[1-2][4-6] | head -n 1`
    1.30 +				tazx `cat /etc/X11/wm.default` ;;
    1.31 +			*)
    1.32 +				# Use specified screen resolution.
    1.33 +				export NEW_SCREEN=$SCREEN
    1.34 +				tazx `cat /etc/X11/wm.default` ;;
    1.35 +		esac
    1.36  	else
    1.37  		tazx `cat /etc/X11/wm.default`
    1.38  	fi