slitaz-tools rev 67

Improved sed on slim.conf (thanks Pascal)
author Christophe Lincoln <pankso@slitaz.org>
date Sat Feb 23 00:54:38 2008 +0100 (2008-02-23)
parents b7cf20bb05db
children ee9bb9111f35
files tinyutils/tazx
line diff
     1.1 --- a/tinyutils/tazx	Fri Feb 22 22:57:37 2008 +0100
     1.2 +++ b/tinyutils/tazx	Sat Feb 23 00:54:38 2008 +0100
     1.3 @@ -28,12 +28,15 @@
     1.4  {
     1.5  	if echo $NEW_SCREEN | grep -q '1280x1024'; then
     1.6  		sed -i s/'1024x768.png'/'1280x1024.png'/ $JWM_CONFIG
     1.7 +		sed -i s/'1280x800.png'/'1280x1024.png'/ $JWM_CONFIG
     1.8  	fi
     1.9  	if echo $NEW_SCREEN | grep -q '1024x768'; then
    1.10  		sed -i s/'1280x1024.png'/'1024x768.png'/ $JWM_CONFIG
    1.11 +		sed -i s/'1280x800.png'/'1024x768.png'/ $JWM_CONFIG
    1.12  	fi
    1.13  	if echo $NEW_SCREEN | grep -q '1280x800'; then
    1.14 -		sed -i s/'1024x768.png'/'1280x800.png'/ $JWM_CONFIG
    1.15 +	    sed -i s/'1024x768.png'/'1280x800.png'/ $JWM_CONFIG
    1.16 +		sed -i s/'1280x1024.png'/'1280x800.png'/ $JWM_CONFIG
    1.17  	fi
    1.18  }
    1.19  
    1.20 @@ -92,7 +95,11 @@
    1.21  			Xvesa -ac -shadow -screen 800x600x16 -br &
    1.22  			exec xterm -cr orange -geometry 80x35+0-0 ;;
    1.23  		*)
    1.24 -			NEW_SCREEN=$value ;;
    1.25 +			NEW_SCREEN=$value
    1.26 +			# /etc/X11/screen.conf exist for Live mode, if this file dos not
    1.27 +			# exist tazx is executed at boot time.
    1.28 +			mkdir -p /etc/X11
    1.29 +			echo "SCREEN=$NEW_SCREEN" > /etc/X11/screen.conf ;;
    1.30  	esac
    1.31  }
    1.32  
    1.33 @@ -100,17 +107,10 @@
    1.34  slim_config()
    1.35  {
    1.36  	if test $(id -u) = 0; then
    1.37 -		# Get current screen size or set default to 1024x768x24 to sed
    1.38 -		# config file with the new value.
    1.39 -		if [ -f /etc/X11/screen.conf ]; then
    1.40 -			. /etc/X11/screen.conf
    1.41 -		else
    1.42 -			SCREEN=1024x768x24
    1.43 -		fi
    1.44 +		# Get current screen size and sed config file with the new value.
    1.45  		if [ -f /etc/slim.conf ]; then
    1.46 -			mkdir -p /etc/X11
    1.47 -			echo "SCREEN=$NEW_SCREEN" > /etc/X11/screen.conf
    1.48 -			sed -i s/"$SCREEN"/"$NEW_SCREEN"/ /etc/slim.conf
    1.49 +			RES=$(grep ^xserver_arguments /etc/slim.conf | sed 's/xserver_arguments.*-screen *//')
    1.50 +			sed "s/\(xserver_arguments.*-screen \).*/\1 $NEW_SCREEN/" /etc/slim.conf
    1.51  		fi
    1.52  		JWM_CONFIG=/etc/jwm/system.jwmrc
    1.53  		change_jwm_background