slitaz-tools rev 513 3.9.1

tazx: now backup old xorg config (Thanks Frederic Guilbault)
author Antoine Bodin <gokhlayeh@slitaz.org>
date Sun Oct 31 00:28:18 2010 +0200 (2010-10-31)
parents 4b0ce259164b
children 147bd1b8757f
files tinyutils/tazx
line diff
     1.1 --- a/tinyutils/tazx	Mon Oct 25 20:53:30 2010 +0000
     1.2 +++ b/tinyutils/tazx	Sun Oct 31 00:28:18 2010 +0200
     1.3 @@ -35,6 +35,9 @@
     1.4  	# Obtain a default configuration file from Xorg.
     1.5  	Xorg -configure :1
     1.6  
     1.7 +	#backup existing config
     1.8 +	tar -cf $xorg_config/../Previous_xorg.conf.d.tar $xorg_config/ &> /dev/null 
     1.9 +
    1.10  	# Put the differents sections in separate files in the configuration directory.
    1.11  	sed -e '/Section "ServerLayout"/,/EndSection/!d' -e "s/EndSection/EndSection\n/" $xorg_template | grep -v Core > $xorg_config/10-ServerLayout.conf
    1.12  	sed -e '/Section "Files"/,/EndSection/!d' -e "s/EndSection/EndSection\n/" $xorg_template > $xorg_config/20-Files.conf
    1.13 @@ -204,10 +207,12 @@
    1.14  		echo "SCREEN=$NEW_SCREEN" > /etc/X11/screen.conf
    1.15  		# Get current screen size and sed config file with the new value.
    1.16  		if [ -f /etc/slim.conf ]; then
    1.17 -			RES=$(grep ^xserver_arguments /etc/slim.conf | \
    1.18 -				sed 's/xserver_arguments.*-screen *//' | awk '{ print $1 }')
    1.19 -			#sed -i "s/\(xserver_arguments.*-screen\).*/\1 $NEW_SCREEN/" /etc/slim.conf
    1.20 -			sed -i s/"-screen $RES"/"-screen $NEW_SCREEN"/ /etc/slim.conf
    1.21 +			    XSERV_ARGS=$(grep ^xserver_arguments /etc/slim.conf)
    1.22 +				RES=$( echo $XSERV_ARGS | sed 's/xserver_arguments.*-screen *//' | awk '{print $1 }') 
    1.23 +				NEW_XSERV_ARGS=$(echo $XSERV_ARGS | sed  s/"-screen $RES"/"-screen $NEW_SCREEN"/) 
    1.24 +			# Comment the old one and put the new one in the config file
    1.25 +			sed -i 's/"$XSERV_ARGS"/"# $XSERV_ARGS\n$NEW_XSERV_ARGS"/' /etc/slim.conf 
    1.26 +
    1.27  		fi
    1.28  	fi
    1.29  }
    1.30 @@ -361,6 +366,7 @@
    1.31  # only by startx, Slim login manager uses .xinitrc).
    1.32  creat_xsession()
    1.33  {
    1.34 +	[ -f $HOME/.xsession ] && cp -f $HOME/.xsession $HOME/.previous_xsession
    1.35  	cat > $HOME/.xsession << _EOF_
    1.36  # ~/.xsession: Start X window session manually on your system (startx).
    1.37  #