slitaz-tools rev 209

tazx: copy files for default user (uid=1000)
author Christophe Lincoln <pankso@slitaz.org>
date Mon Jun 09 23:42:17 2008 +0200 (2008-06-09)
parents 97f8751d0751
children c7924faf5a51
files tinyutils/tazx
line diff
     1.1 --- a/tinyutils/tazx	Tue May 27 15:32:37 2008 +0000
     1.2 +++ b/tinyutils/tazx	Mon Jun 09 23:42:17 2008 +0200
     1.3 @@ -3,7 +3,9 @@
     1.4  # Tazx - Ncurses X configuration for SliTaz GNU/Linux using Dialog boxes.
     1.5  # This tinyutils is part of slitaz-tools.
     1.6  #
     1.7 -# 20080313 <pankso@slitaz.org> - GNU gpl v3.
     1.8 +# (c) 20080609 SliTaz GNU/Linux - GNU gpl v3.
     1.9 +# Authors: Christophe Lincoln <pankso@slitaz.org>
    1.10 +#          Pascal Bellard <pascal.bellard@slitaz.org>
    1.11  #
    1.12  : ${DIALOG=tazdialog}
    1.13  
    1.14 @@ -18,6 +20,8 @@
    1.15  else
    1.16  	WM=openbox
    1.17  fi
    1.18 +# Default user for config files
    1.19 +USER=`cat /etc/passwd | grep 1000 | cut -d ":" -f 1`
    1.20  
    1.21  ####################
    1.22  #  Tazx functions  #
    1.23 @@ -159,16 +163,16 @@
    1.24  			mkdir -p $HOME/.config/openbox
    1.25  			cp /etc/xdg/openbox/autostart.sh $HOME/.config/openbox
    1.26  		fi
    1.27 -		# Script for hacker.
    1.28 -		if [ ! -f "/home/hacker/.config/openbox/autostart.sh" ]; then
    1.29 -			mkdir -p /home/hacker/.config/openbox
    1.30 -			cp /etc/xdg/openbox/autostart.sh /home/hacker/.config/openbox
    1.31 +		# Script for default user (uid=1000).
    1.32 +		if [ ! -f "/home/$USER/.config/openbox/autostart.sh" ]; then
    1.33 +			mkdir -p /home/$USER/.config/openbox
    1.34 +			cp /etc/xdg/openbox/autostart.sh /home/$USER/.config/openbox
    1.35  		fi
    1.36 -		if [ ! -f "/home/hacker/.config/openbox/menu.xml" ]; then
    1.37 -			mkdir -p /home/hacker/.config/openbox
    1.38 -			cp /etc/xdg/openbox/menu.xml /home/hacker/.config/openbox
    1.39 +		if [ ! -f "/home/$USER/.config/openbox/menu.xml" ]; then
    1.40 +			mkdir -p /home/$USER/.config/openbox
    1.41 +			cp /etc/xdg/openbox/menu.xml /home/$USER/.config/openbox
    1.42  		fi
    1.43 -		chown -R hacker.hacker /home/hacker/.config
    1.44 +		chown -R $USER.$USER /home/$USER/.config
    1.45  	fi
    1.46  }
    1.47  
    1.48 @@ -209,12 +213,12 @@
    1.49  	FILE=$HOME/.xinitrc
    1.50  	xinitrc_sample
    1.51  
    1.52 -	# In Live mode hacker needs a xinitrc, since tazx
    1.53 +	# In Live mode default user needs a xinitrc, since tazx
    1.54  	# is executed only by root.
    1.55 -	if [ ! -f /home/hacker/.xinitrc ]; then
    1.56 -		FILE=/home/hacker/.xinitrc
    1.57 +	if [ ! -f /home/$USER/.xinitrc ]; then
    1.58 +		FILE=/home/$USER/.xinitrc
    1.59  		xinitrc_sample
    1.60 -		chown hacker.hacker $FILE
    1.61 +		chown $USER.$USER $FILE
    1.62  	fi
    1.63  }
    1.64  
    1.65 @@ -226,12 +230,13 @@
    1.66  		if [ ! -f "$JWM_CONFIG" ]; then
    1.67  			cp /etc/jwm/system.jwmrc $JWM_CONFIG
    1.68  		fi
    1.69 -		# In Live mode hacker/root JWM config dose not exist ans $HOME is
    1.70 -		# ot set, this is because tazx is executed by boot scripts.
    1.71 -		if [ ! -f "/home/hacker/.jwmrc" ]; then
    1.72 -			JWM_CONFIG=/home/hacker/.jwmrc
    1.73 +		# In Live mode default user/root JWM config dose not exist and
    1.74 +		# $HOME is ot set, this is because tazx is executed by boot 
    1.75 +		# scripts.
    1.76 +		if [ ! -f "/home/$USER/.jwmrc" ]; then
    1.77 +			JWM_CONFIG=/home/$USER/.jwmrc
    1.78  			cp /etc/jwm/system.jwmrc $JWM_CONFIG
    1.79 -			chown hacker.hacker $JWM_CONFIG
    1.80 +			chown $USER.$USER $JWM_CONFIG
    1.81  		fi
    1.82  		if [ ! -f "/root/.jwmrc" -a `id -u` = 0 ]; then
    1.83  			JWM_CONFIG=/root/.jwmrc