slitaz-tools rev 615

tazx: only root can config Xorg (Thanks Stephane)
author Christophe Lincoln <pankso@slitaz.org>
date Fri Jun 03 12:34:16 2011 +0200 (2011-06-03)
parents 2c5ee7f946f1
children 0cb994668891
files tinyutils/tazx
line diff
     1.1 --- a/tinyutils/tazx	Thu Jun 02 15:29:01 2011 -0300
     1.2 +++ b/tinyutils/tazx	Fri Jun 03 12:34:16 2011 +0200
     1.3 @@ -17,9 +17,13 @@
     1.4  # created by /etc/init.d/bootopts.sh.
     1.5  USER=`cat /etc/passwd | grep 1000 | cut -d ":" -f 1`
     1.6  
     1.7 -####################
     1.8 -#  Tazx functions  #
     1.9 -####################
    1.10 +
    1.11 +# Functions
    1.12 +
    1.13 +# Be sure we're root.
    1.14 +check_root() {
    1.15 +	[ $(id -u) != 0 ] && gettext -e "\nYou must be root to cook.\n\n" && exit 0
    1.16 +}
    1.17  
    1.18  # Populate xorg.conf.d.
    1.19  xorg_conf_d()
    1.20 @@ -332,13 +336,12 @@
    1.21  	chmod 700 $HOME/.xsession
    1.22  }
    1.23  
    1.24 -###################
    1.25 -#  Tazx sequence  #
    1.26 -###################
    1.27 +
    1.28 +# Commands - WM can be specified on cmdline.
    1.29  
    1.30  case "$1" in
    1.31  	install-xorg)
    1.32 -		# WM can be specified on cmdline.
    1.33 +		check_root
    1.34  		if [ -n "$2" ]; then
    1.35  			WM=$2
    1.36  		fi
    1.37 @@ -348,7 +351,7 @@
    1.38  		creat_xinitrc
    1.39  		creat_xsession ;;
    1.40  	config-xorg)
    1.41 -		# WM can be specified on cmdline.
    1.42 +		check_root
    1.43  		if [ -n "$2" ]; then
    1.44  			WM=$2
    1.45  		fi
    1.46 @@ -363,11 +366,10 @@
    1.47  				/etc/X11/xorg.conf.d/70-Screen.conf
    1.48  		fi ;;
    1.49  	*)
    1.50 -		# WM can be specified on cmdline.
    1.51 +		# User can get a new .xinitrc with tazx from cmdline.
    1.52  		if [ -n "$1" ]; then
    1.53  			WM=$1
    1.54  		fi
    1.55 -		# User can get a new .xinitrc with tazx from cmdline.
    1.56  		if test $(id -u) = 0; then
    1.57  			echo "xorg" > /etc/X11/screen.conf
    1.58  			screen_config_dialog