slitaz-tools diff installer/tazinst @ rev 654

tazinst: gettextization
author Dominique Corbex <domcox@slitaz.org>
date Tue Jul 19 22:52:27 2011 +0200 (2011-07-19)
parents 2c63e52fec7d
children b28d4a6bf467
line diff
     1.1 --- a/installer/tazinst	Mon Jun 06 18:54:50 2011 +0100
     1.2 +++ b/installer/tazinst	Tue Jul 19 22:52:27 2011 +0200
     1.3 @@ -9,30 +9,27 @@
     1.4  #
     1.5  # Authors : Christophe Lincoln <pankso@slitaz.org>
     1.6  #           Dominique Corbex <domcox@slitaz.org>
     1.7 +#
     1.8 +# Exit codes
     1.9 +# 1: Parameters error 
    1.10 +# 2: Configuration file error
    1.11 +# 3: Source error
    1.12 +# 4: Cancelled by user
    1.13 +# 5: Target partition error
    1.14 +# 6: No SliTaz system to upgrade found
    1.15 +# 8: Internal error
    1.16  
    1.17 -VERSION=2.991
    1.18 +VERSION=3.0
    1.19  
    1.20 -# Install tests (2011-06-01): 
    1.21 -# from iso ok
    1.22 -# from web ok
    1.23 -# stable-2.0 ok
    1.24 -# stable-3.0 ok
    1.25 -# cooking-20110329 ok
    1.26 -# cooking-20110531 broken (xorg)
    1.27 -
    1.28 -# Upgrade tests:
    1.29 -# 
    1.30 -
    1.31 -#
    1.32  SOURCE_ROOT=/media/source
    1.33  TARGET_ROOT=/mnt/target
    1.34  LOG=/var/log/tazinst.log
    1.35  BACKLIST="SliTaz GNU/Linux installer"
    1.36  
    1.37 -# Default debug
    1.38 +# DEBUG=1: Enable debug msgs
    1.39  DEBUG=0
    1.40  
    1.41 -# Mirror urls
    1.42 +# Predefined urls
    1.43  URL_STABLE="http://mirror.slitaz.org/iso/stable/slitaz-4.0.iso"
    1.44  URL_COOKING="http://mirror.slitaz.org/iso/cooking/slitaz-cooking.iso"
    1.45  URL_ROLLING="http://mirror.slitaz.org/iso/rolling/slitaz-core.iso"
    1.46 @@ -73,8 +70,8 @@
    1.47  	if mount | grep -q $TARGET_ROOT; then
    1.48  		umount $TARGET_ROOT 2>>$LOG
    1.49  	fi
    1.50 -	echo "`gettext \"Error\"` $@"
    1.51 -	echo "`gettext \"Installation cancelled\"`"
    1.52 +	echo -e "`gettext \"Error\"` $@"
    1.53 +	echo -e "`gettext \"Installation cancelled\"`"
    1.54  	test $(id -u) = 0 && echo "Installation cancelled on error $@" >> $LOG
    1.55  	exit $1
    1.56  }
    1.57 @@ -82,7 +79,7 @@
    1.58  # Print a warning msg
    1.59  warning()
    1.60  {
    1.61 -	echo "`gettext \"Warning:\"` $@" | tee -a $LOG
    1.62 +	echo -e "`gettext \"Warning:\"` $@" | tee -a $LOG
    1.63  }
    1.64  
    1.65  # Print a debug msg
    1.66 @@ -108,7 +105,7 @@
    1.67  gen_config()
    1.68  {
    1.69  	CONFILE=$1
    1.70 -	touch $CONFILE || error 1 "Unable to write $CONFILE"
    1.71 +	touch $CONFILE || abort 2 `gettext "Unable to write to $CONFILE"`
    1.72  	if [ -r "$CONFILE" ]; then
    1.73  		cat > $CONFILE << _EOF_
    1.74  # tazinst.conf: SliTaz Installer configuration file.
    1.75 @@ -157,9 +154,6 @@
    1.76  # Grub bootloader
    1.77  # install grub [yes|no]
    1.78  TGT_GRUB="no"
    1.79 -# Where to find menu.lst (dedicated grub part. or multi-os install)
    1.80 -# If you don't know what to do, it's safe to leave it blank
    1.81 -TGT_MENU_PARTITION=""
    1.82  
    1.83  # Windows dual-boot
    1.84  # Dual boot is disabled if WINBOOT is empty: TGT_WINBOOT=""
    1.85 @@ -170,7 +164,7 @@
    1.86  _EOF_
    1.87  
    1.88  	else
    1.89 -		abort 2 "Configuration file $CONFILE not found"
    1.90 +		abort 2 `gettext "Configuration file $CONFILE not found"`
    1.91  	fi
    1.92  }
    1.93  
    1.94 @@ -207,12 +201,12 @@
    1.95  			debug "Using config-file=$CONFILE"
    1.96  			# source doesn't like file without a path
    1.97  			[ $(echo "$CONFILE" | grep -c "/") == "0" ] && CONFILE="./$CONFILE"
    1.98 -			source $CONFILE || abort 2 "Unable to read $CONFILE"
    1.99 +			source $CONFILE || abort 2 `gettext "Unable to read $CONFILE"`
   1.100  		else
   1.101 -			abort 2 "Configuration file not found"
   1.102 +			abort 2 `gettext "Configuration file not found"`
   1.103  		fi
   1.104  	else
   1.105 -		abort 2 "No configuration file provided"
   1.106 +		abort 2 `gettext "No configuration file provided"`
   1.107  	fi
   1.108  }
   1.109  
   1.110 @@ -238,11 +232,11 @@
   1.111  	done
   1.112  
   1.113  	# Duplicate install modes are forbidden
   1.114 -	[ -n "$INSTALL" ] && [ -n "$UPGRADE" ] && abort 1 "Mismatched parameters"
   1.115 +	[ -n "$INSTALL" ] && [ -n "$UPGRADE" ] && abort 1 `gettext "Mismatched parameters"`
   1.116  	INST_ACTION="$INSTALL$UPGRADE"
   1.117  	# Don't allow formatting on upgrades
   1.118  	[ "$INST_ACTION" == "upgrade" ] && [ -n "$TGT_FS" ] && \
   1.119 -		warning "Partition $TGT_PARTITION will not be formatted during upgrade"
   1.120 +		warning `gettext "Partition $TGT_PARTITION will not be formatted during upgrade"`
   1.121  }
   1.122  
   1.123  # check main vars
   1.124 @@ -272,7 +266,7 @@
   1.125  	# Check Action
   1.126  	case $INST_ACTION in
   1.127  		install|upgrade) ;;
   1.128 -		*) msg "INST_ACTION=$INST_ACTION: Invalid setting"; error=yes ;;
   1.129 +		*) msg `gettext "INST_ACTION=$INST_ACTION: Invalid setting"`; error=yes ;;
   1.130  	esac
   1.131  
   1.132  	# Check Type
   1.133 @@ -281,9 +275,9 @@
   1.134  		usb|iso|web)
   1.135  			# We need a valid source 
   1.136  			if [ -z "$SRC_FILE" ]; then
   1.137 -				echo "Type is $INST_TYPE, but INST_SOURCE is not set"; error=yes
   1.138 +				msg `gettext "Type is $INST_TYPE, but INST_SOURCE is not set"`; error=yes
   1.139  			fi ;;
   1.140 -		*) msg "INST_TYPE=$INST_TYPE: Invalid setting"; error=yes ;;
   1.141 +		*) msg `gettext "INST_TYPE=$INST_TYPE: Invalid setting"`; error=yes ;;
   1.142  	esac
   1.143  
   1.144  	# Check Source file
   1.145 @@ -297,11 +291,11 @@
   1.146  	case $INST_TYPE in
   1.147  		iso)
   1.148  			if [ ! -r "$SRC_FILE" ]; then
   1.149 -				msg "SRC_FILE=$SRC_FILE: file not found" ; error=yes
   1.150 +				msg `gettext "SRC_FILE=$SRC_FILE: file not found"`; error=yes
   1.151  			fi ;;
   1.152  		web)
   1.153  			if [ $(wget -sq "$SRC_FILE") ]; then
   1.154 -				msg "SRC_FILE=$SRC_FILE: file not found" ; error=yes
   1.155 +				msg `gettext "SRC_FILE=$SRC_FILE: file not found on the web"`; error=yes
   1.156  			fi ;;
   1.157  	esac
   1.158  
   1.159 @@ -312,7 +306,7 @@
   1.160  		[ "$partition" == "$TGT_PARTITION" ] && found="yes"
   1.161  	done
   1.162  	if [ "$found" != "yes" ]; then
   1.163 -		msg "TGT_PARTITION=$TGT_PARTITION Partition not found"; error=yes
   1.164 +		msg `gettext "TGT_PARTITION=$TGT_PARTITION Partition not found"`; error=yes
   1.165  	fi
   1.166  
   1.167  	# Check Filesystem
   1.168 @@ -324,9 +318,9 @@
   1.169  				[ -x "$xdir/mkfs.$TGT_FS" ] && found=yes
   1.170  			done
   1.171  			if [ "$found" == "no" ]; then
   1.172 -				msg "$TGT_FS: mkfs.$TGT_FS is not installed."; error=yes
   1.173 +				msg `gettext "$TGT_FS: mkfs.$TGT_FS is not installed."`; error=yes
   1.174  			fi ;;
   1.175 -		*) msg "TGT_FS=$TGT_FS: Invalid setting"; error=yes ;;
   1.176 +		*) msg `gettext "TGT_FS=$TGT_FS: Unknown filesystem"`; error=yes ;;
   1.177  	esac
   1.178  
   1.179  	# Check Home partition
   1.180 @@ -336,7 +330,7 @@
   1.181  			[ "$partition" == "$TGT_HOME" ] && found=yes
   1.182  		 done
   1.183  		if [ "$found" != "yes" ]; then
   1.184 -			msg "TGT_HOME=$TGT_HOME: Not found"; error=yes
   1.185 +			msg `gettext "TGT_HOME=$TGT_HOME: Partition not found"`; error=yes
   1.186  		fi
   1.187  	fi
   1.188  
   1.189 @@ -349,15 +343,15 @@
   1.190  				[ -x "$xdir/mkfs.$TGT_FS" ] && found=yes
   1.191  			done
   1.192  			if [ "$found" == "no" ]; then
   1.193 -				msg "$TGT_FS: mkfs.$TGT_FS is not installed."; error=yes
   1.194 +				msg `gettext "$TGT_FS: mkfs.$TGT_FS is not installed."`; error=yes
   1.195  			fi ;;
   1.196 -		*) msg "TGT_HOME_FS=$TGT_HOME_FS: Invalid setting"; error=yes ;;
   1.197 +		*) msg `gettext "TGT_HOME_FS=$TGT_HOME_FS: unknown filesystem"`; error=yes ;;
   1.198  	esac
   1.199  
   1.200  	# Check Grub
   1.201  	case $TGT_GRUB in
   1.202  		yes|no) ;;
   1.203 -		*) msg "TGT_GRUB=$TGT_GRUB: Invalid setting"; error=yes ;;
   1.204 +		*) msg `gettext "TGT_GRUB=$TGT_GRUB: Invalid setting"`; error=yes ;;
   1.205  	esac
   1.206  
   1.207  	# Check Winboot
   1.208 @@ -365,7 +359,7 @@
   1.209  		"") ;;
   1.210  		auto) ;;
   1.211  		hd[[:digit:]],[[:digit:]]) ;;
   1.212 -		*) msg "TGT_WINBOOT=$TGT_WINBOOT: Invalid format"; error=yes ;;
   1.213 +		*) msg `gettext "TGT_WINBOOT=$TGT_WINBOOT: Invalid format"`; error=yes ;;
   1.214  	esac
   1.215  
   1.216  	# Stop on error
   1.217 @@ -376,8 +370,8 @@
   1.218  check_root()
   1.219  {
   1.220  	if test $(id -u) != 0 ; then
   1.221 -		echo "You must be the root user (system administrator) to install SliTaz, \
   1.222 -please use 'su' to get a root SHell and restart installation."
   1.223 +		echo -e "`gettext \"You must be the root user (system administrator) to install SliTaz, \
   1.224 +please use 'su' to get a root SHell and restart installation.\"`"
   1.225  		exit 0
   1.226  	fi
   1.227  }
   1.228 @@ -393,7 +387,7 @@
   1.229  		debug "Using files from cdrom ($CDROM)..."
   1.230  		sleep 2
   1.231  	else
   1.232 -		warning "Failed to mount $CDROM"
   1.233 +		warning `gettext "Failed to mount $CDROM"`
   1.234  	fi
   1.235  }
   1.236  
   1.237 @@ -412,7 +406,7 @@
   1.238  			debug "Using files from USB device ($SRC_FILE)..."
   1.239  			SOURCE_STATUS="mount"
   1.240  		else
   1.241 -			warning "Failed to mount USB device $SRC_FILE"
   1.242 +			warning `gettext "Failed to mount USB device $SRC_FILE"`
   1.243  		fi
   1.244  	fi
   1.245  }
   1.246 @@ -425,16 +419,16 @@
   1.247  	src_md5=$(echo $SRC_FILE | sed 's/.iso$/.md5/')
   1.248  	if [ -r "$src_md5" ]; then
   1.249  		[ $(md5sum $SRC_FILE | cut -d' ' -f1) == $(cat "$src_md5" | cut -d' ' -f1) ] || \
   1.250 -			abort 3 "$SRC-FILE corrupted"
   1.251 +			abort 3 `gettext "$SRC-FILE corrupted"`
   1.252  	else
   1.253 -		warning "$src_md5 not found, unable to check integrity of $SRC_FILE"	
   1.254 +		warning `gettext "$src_md5 not found, unable to check integrity of $SRC_FILE"`
   1.255  	fi
   1.256  	# Try to mount ISO
   1.257  	if mount -o loop -t iso9660 $SRC_FILE $SOURCE_ROOT 2>>$LOG; then
   1.258  		debug "Using files from ISO ($SRC_FILE)..."
   1.259  		sleep 2
   1.260  	else
   1.261 -		warning "Failed to mount ISO '$SRC_FILE'"
   1.262 +		warning `gettext "Failed to mount ISO '$SRC_FILE'"`
   1.263  	fi
   1.264  }
   1.265  
   1.266 @@ -446,11 +440,11 @@
   1.267  	if wget $SRC_FILE -P /tmp; then
   1.268  		debug "Download completed."
   1.269  	else
   1.270 -		warning "Failed to download '$SRC_FILE'"
   1.271 +		warning `gettext "Failed to download '$SRC_FILE'"`
   1.272  	fi
   1.273  	src_md5=$(echo $SRC_FILE | sed 's/.iso$/.md5/')
   1.274  	debug "Downloading $src_md5"
   1.275 -	wget $src_md5 -P /tmp || warning "Failed to download '$src_md5'"
   1.276 +	wget $src_md5 -P /tmp || warning `gettext "Failed to download '$src_md5'"`
   1.277  	tmpfile=$(echo $SRC_FILE | awk 'BEGIN{RS="/"}{out=$1}END{printf"%s",out}')
   1.278  	SRC_FILE="/tmp/$tmpfile"
   1.279  	check_iso
   1.280 @@ -464,7 +458,7 @@
   1.281  		ln -s $SRC_FILE/boot $SOURCE_ROOT/boot
   1.282  		sleep 2
   1.283  	else
   1.284 -		abort 3 "Error: Web boot files not found"
   1.285 +		abort 3 `gettext "Web boot files not found"`
   1.286  	fi
   1.287  }
   1.288  
   1.289 @@ -487,14 +481,14 @@
   1.290  		check_cdrom
   1.291  		check_web ;;
   1.292  	*)
   1.293 -		abort 8 "Internal" ;;
   1.294 +		abort 8 `gettext "Internal"` ;;
   1.295  	esac
   1.296  
   1.297  	# Exit with error msg if no rootfs.gz found.
   1.298  	debug "Checking installation media..."
   1.299  	if [ ! -f $SOURCE_ROOT/boot/rootfs.gz -a \
   1.300  		 ! -f $SOURCE_ROOT/boot/rootfs1.gz ]; then
   1.301 -		abort 3 "Invalid source"
   1.302 +		abort 3 `gettext "Invalid source"`
   1.303  	else
   1.304  		debug "Installation media checked ok"
   1.305  	fi
   1.306 @@ -503,39 +497,39 @@
   1.307  # Tiny summary
   1.308  summary()
   1.309  {
   1.310 -	echo "Installation settings summary:"
   1.311 +	echo -e "`gettext \"Installation settings summary:\"`"
   1.312  	STEP=0
   1.313  
   1.314  	if [ "$INST_ACTION" == "install" ]; then
   1.315  		if [ -n "$TGT_FS" ]; then
   1.316 -			msg "Format root partition '$TGT_PARTITION' ($TGT_FS)"
   1.317 +			msg `gettext "Format root partition '$TGT_PARTITION' ($TGT_FS)"`
   1.318  		fi
   1.319  		if [ -n "$TGT_HOME_FS" ]; then
   1.320 -			msg "Format /home partition '$TGT_HOME' ($TGT_HOME_FS)"
   1.321 +			msg `gettext "Format /home partition '$TGT_HOME' ($TGT_HOME_FS)"`
   1.322  		fi	
   1.323 -		msg "Install SliTaz on '$TGT_PARTITION' from $INST_TYPE"
   1.324 -		[ -n "$TGT_HOME" ] && msg "Set Home partition to '$TGT_HOME'"
   1.325 -		msg "Set Hostname as '$TGT_HOSTNAME'"
   1.326 -		msg "Set Default user as '$TGT_USER'"
   1.327 +		msg `gettext "Install SliTaz on '$TGT_PARTITION' from $INST_TYPE"`
   1.328 +		[ -n "$TGT_HOME" ] && msg `gettext "Set Home partition to '$TGT_HOME'"`
   1.329 +		msg `gettext "Set Hostname as '$TGT_HOSTNAME'"`
   1.330 +		msg `gettext "Set Default user as '$TGT_USER'"`
   1.331  	else
   1.332 -		msg "Check '$TGT_PARTITION'"
   1.333 -		msg "Backup /etc, /home and the packages list"
   1.334 -		msg "Upgrade SliTaz on '$TGT_PARTITION' from $INST_TYPE"
   1.335 -		msg "Restore /etc, /home"
   1.336 -		msg "Upgrade additional packages."
   1.337 +		msg `gettext "Check '$TGT_PARTITION'"`
   1.338 +		msg `gettext "Backup /etc, /home and the packages list"`
   1.339 +		msg `gettext "Upgrade SliTaz on '$TGT_PARTITION' from $INST_TYPE"`
   1.340 +		msg `gettext "Restore /etc, /home"`
   1.341 +		msg `gettext "Upgrade additional packages."`
   1.342  	fi
   1.343  	if [ -n "$TGT_WINBOOT" ]; then
   1.344 -		msg "Enable Windows dual-boot ($TGT_WINBOOT)"
   1.345 +		msg `gettext "Enable Windows dual-boot ($TGT_WINBOOT)"`
   1.346  	fi
   1.347  	if [ "$TGT_GRUB" == "yes" ]; then
   1.348 -		msg "Install Grub"
   1.349 +		msg `gettext "Install Grub"`
   1.350  	fi
   1.351  
   1.352 -	echo -n "Continue:(y/n)"
   1.353 +	echo -ne "`gettext \"Continue:(y/n)\"`"
   1.354  	read answer
   1.355  	case $answer in
   1.356 -		[yY]) echo "Running $BACKLIST.." ;;
   1.357 -		*) abort 4 "Cancelled by user" ;;
   1.358 +		[yY]) echo -e "`gettext \"Running $BACKLIST..\"`" ;;
   1.359 +		*) abort 4 `gettext "Cancelled by user"` ;;
   1.360  	esac
   1.361  	STEP=0
   1.362  }
   1.363 @@ -550,7 +544,7 @@
   1.364  	debug "Preparing target partition..."
   1.365  	# Target may be used
   1.366  	mount | grep -q $TGT_PARTITION && \
   1.367 -		abort 5 $TGT_PARTITION": Partition in use"
   1.368 +		abort 5 `gettext $TGT_PARTITION": Partition in use"`
   1.369  	# Mount point can be already used.
   1.370  	if mount | grep -q $TARGET_ROOT; then
   1.371  		umount $TARGET_ROOT 2>>$LOG
   1.372 @@ -564,7 +558,7 @@
   1.373  #			ROOT_FS=$(parted /dev/hda5 print -m | grep "^1:" | cut -d':' -f5) ;;
   1.374  			ROOT_FS=auto ;;
   1.375  		*)
   1.376 -			msg "Formatting $TGT_PARTITION ($TGT_FS)"
   1.377 +			msg `gettext "Formatting $TGT_PARTITION ($TGT_FS)"`
   1.378  			mkfs.$TGT_FS $TGT_PARTITION >>$LOG 2>>$LOG
   1.379  			ROOT_FS=$TGT_FS ;;
   1.380  	esac
   1.381 @@ -576,7 +570,7 @@
   1.382  			"")
   1.383  				debug "The partition ($TGT_HOME) will be kept..." ;;
   1.384  			*)
   1.385 -				msg "Formatting /home on $TGT_HOME ($TGT_HOME_FS)"
   1.386 +				msg `gettext "Formatting /home on $TGT_HOME ($TGT_HOME_FS)"`
   1.387  				mkfs.$TGT_HOME_FS -L "Home" $TGT_HOME >>$LOG 2>>$LOG ;;
   1.388  		esac
   1.389  		sleep 2
   1.390 @@ -589,7 +583,7 @@
   1.391  
   1.392  	mount -t $ROOT_FS $TGT_PARTITION $TARGET_ROOT >>$LOG 2>>$LOG
   1.393  	if [ $(mount | grep -c "mnt/target") == "0" ]; then
   1.394 -		abort 5 "Can't mount $TGT_PARTITION"
   1.395 +		abort 5 `gettext "Can't mount $TGT_PARTITION"`
   1.396  	fi
   1.397  }
   1.398  
   1.399 @@ -600,7 +594,7 @@
   1.400  		# partition was not formatted
   1.401  		debug "Cleaning the root partition ($TGT_PARTITION)..."
   1.402  		# Keep /home in case of reinstall.
   1.403 -		cd $TARGET_ROOT || abort 8 "Internal"
   1.404 +		cd $TARGET_ROOT || abort 8 `gettext "Internal"`
   1.405  		for dir in *
   1.406  		do
   1.407  			case "$dir" in
   1.408 @@ -628,7 +622,7 @@
   1.409  		KERNEL=$(ls /$TARGET_ROOT/lib/modules | tail -1)
   1.410  		KERNEL="vmlinuz-$KERNEL"
   1.411  	else
   1.412 -		warning "Falling back to running kernel name.."
   1.413 +		warning `gettext "Falling back to running kernel name.."`
   1.414  		KERNEL=vmlinuz-`uname -r`
   1.415  	fi
   1.416  	mkdir -p $TARGET_ROOT/boot
   1.417 @@ -693,7 +687,7 @@
   1.418  {
   1.419  	local isloramfs
   1.420  	isloramfs=
   1.421 -	cd $TARGET_ROOT || abort 8 "Internal"
   1.422 +	cd $TARGET_ROOT || abort 8 `gettext "Internal"`
   1.423  	if [ -d $1/../fs/etc ]; then
   1.424  		# This is a tazlitobox loram (cdrom)
   1.425  		cp -a $1/../fs/. .
   1.426 @@ -728,7 +722,7 @@
   1.427  # Pre configure freshly installed system (60 - 80%).
   1.428  pre_config_system()
   1.429  {
   1.430 -	cd $TARGET_ROOT || abort 8 "Internal"
   1.431 +	cd $TARGET_ROOT || abort 8 `gettext "Internal"`
   1.432  	# Restore backup of existing /home if exists.
   1.433  	# (created by prepare_target_dev)
   1.434  	if [ -d home.bak ]; then
   1.435 @@ -743,7 +737,7 @@
   1.436  	sed -i s#'CHECK_FS=\"\"'#"CHECK_FS=\"$TGT_PARTITION\""# etc/rcS.conf
   1.437  	sleep 2
   1.438  	# Set hostname.
   1.439 -	msg "Configuring host name: $TGT_HOSTNAME"
   1.440 +	msg `gettext "Configuring host name: $TGT_HOSTNAME"`
   1.441  	echo $TGT_HOSTNAME > etc/hostname
   1.442  }
   1.443  
   1.444 @@ -752,7 +746,7 @@
   1.445  {
   1.446  	cat > $TARGET_ROOT/users.sh << _EOF_
   1.447  #!/bin/sh
   1.448 -echo "root:$TGT_ROOT_PWD" | chpasswd
   1.449 +echo "root:$TGT_ROOT_PWD" | chpasswd > /etc/null
   1.450  adduser -D -H $TGT_USER
   1.451  
   1.452  for grp in audio cdrom floppy dialout disk kmem tape tty video; do
   1.453 @@ -761,13 +755,18 @@
   1.454   fi
   1.455  done
   1.456  
   1.457 -echo "$TGT_USER:$TGT_USER_PWD" | chpasswd
   1.458 +echo "$TGT_USER:$TGT_USER_PWD" | chpasswd > /etc/null
   1.459  if [ ! -d /home/$TGT_USER ]; then
   1.460  	cp -a /etc/skel /home/$TGT_USER
   1.461  	[ -e /root/.xinitrc ] && cp /root/.xinitrc /home/$TGT_USER
   1.462  	mkdir -p /home/$TGT_USER/.config/slitaz
   1.463  	cp -a /etc/slitaz/applications.conf /home/$TGT_USER/.config/slitaz
   1.464 -	chown -R $TGT_USER:users /home/$TGT_USER
   1.465 +	# chmod $TGT_USER:user doesn't work with most ISO
   1.466 +	if grep -q ^users: /etc/group; then
   1.467 +		chown -R $TGT_USER:users /home/$TGT_USER
   1.468 +	else
   1.469 +		chown -R $TGT_USER:$TGT_USER /home/$TGT_USER
   1.470 +	fi
   1.471  	# Path for user desktop files.
   1.472  	for i in /home/$TGT_USER/.local/share/applications/*.desktop
   1.473  	do
   1.474 @@ -791,7 +790,7 @@
   1.475  home_config()
   1.476  {
   1.477  	debug "home_config: $TGT_HOME"
   1.478 -	cd $TARGET_ROOT || abort 8 "Internal"
   1.479 +	cd $TARGET_ROOT || abort 8 `gettext "Internal"`
   1.480  	mv home/$TGT_USER tmp
   1.481  	mount $TGT_HOME home
   1.482  	if [ -d $TARGET_ROOT/home/$TGTUSER ]; then
   1.483 @@ -807,7 +806,7 @@
   1.484  # Search for a Windows partition
   1.485  win_partition()
   1.486  {
   1.487 -	msg "Enabling Windows dual-boot"
   1.488 +#	msg `gettext "Searching for Windows"`
   1.489  	if [ "$TGT_WINBOOT" == "auto" ];then
   1.490  		WINBOOT=$(fdisk -l | awk '
   1.491  BEGIN{disk=-1,	found=-1,	winboot=""}
   1.492 @@ -827,7 +826,7 @@
   1.493  }
   1.494  END{printf "%s", winboot}')
   1.495  		if [ -z "$WINBOOT" ]; then
   1.496 -			warning "No windows partition found. Dual-boot disabled"
   1.497 +			warning `gettext "No windows partition found. Dual-boot disabled"`
   1.498  			TGT_WINBOOT=""
   1.499  		fi
   1.500  	fi
   1.501 @@ -884,6 +883,7 @@
   1.502  
   1.503  _EOF_
   1.504  	if [ -n "$TGT_WINBOOT" ]; then
   1.505 +		msg `gettext "Enabling Windows dual-boot"`
   1.506  		cat >> $TARGET_ROOT/boot/grub/menu.lst << _EOF_
   1.507  # For booting Windows :
   1.508  #
   1.509 @@ -904,7 +904,7 @@
   1.510  # Files install, calling for functions or with cmds.
   1.511  install_files()
   1.512  {
   1.513 -	msg "Installing SliTaz on $TGT_PARTITION"
   1.514 +	msg `gettext "Installing SliTaz on $TGT_PARTITION"`
   1.515  	# saving pwd
   1.516  	local save_pwd=$(pwd)
   1.517  
   1.518 @@ -923,11 +923,11 @@
   1.519  	debug "Preconfiguring the system..."
   1.520  	pre_config_system
   1.521  
   1.522 -	msg "Configuring root and default $TGT_USER account..."
   1.523 +	msg `gettext "Configuring root and default $TGT_USER account..."`
   1.524  	users_settings
   1.525  
   1.526  	if [ "$TGT_HOME" != "" ]; then
   1.527 -		msg "Configuring $TGT_HOME to be used as /home..."
   1.528 +		msg `gettext "Configuring $TGT_HOME to be used as /home..."`
   1.529  		home_config
   1.530  		sleep 2
   1.531  	fi
   1.532 @@ -946,7 +946,7 @@
   1.533  {
   1.534  	if [ "$TGT_GRUB" == "yes" ]; then
   1.535  		TARGET_DISK=`echo $TGT_PARTITION | sed s/"[0-9]"/''/`
   1.536 -		msg "Running grub-install on : $TARGET_DISK"
   1.537 +		msg `gettext "Running grub-install on : $TARGET_DISK"`
   1.538  		grub-install --no-floppy \
   1.539  				--root-directory=$TARGET_ROOT $TARGET_DISK 2>>$LOG
   1.540  		debug "Grub installation done..."
   1.541 @@ -960,19 +960,19 @@
   1.542  {
   1.543  	# Umount target
   1.544  	if mount | grep -q $TARGET_ROOT; then
   1.545 -		echo "Unmounting target ($TGT_PARTITION)..."
   1.546 +		echo -e "`gettext \"Unmounting target ($TGT_PARTITION)...\"`"
   1.547  	umount $TARGET_ROOT 2>>$LOG
   1.548  	fi
   1.549  
   1.550  	# Umount source
   1.551  	if mount | grep -q $SOURCE_ROOT; then
   1.552 -		echo "Unmounting $SOURCE_ROOT"
   1.553 +		echo -e "`gettext \"Unmounting $SOURCE_ROOT\"`"
   1.554  		umount $SOURCE_ROOT
   1.555  	fi
   1.556  
   1.557  	# Eject cd
   1.558  	if [ "$INST_TYPE" == "cdrom" ]; then
   1.559 -		echo "Ejecting cdrom..."
   1.560 +		echo -e "`gettext \"Ejecting cdrom...\"`"
   1.561  		eject
   1.562  	fi
   1.563  	sleep 2
   1.564 @@ -981,11 +981,11 @@
   1.565  # End of installation.
   1.566  end_of_install()
   1.567  {
   1.568 -	echo "Installation complete. You can now restart (reboot) \
   1.569 -from your SliTaz GNU/Linux system."
   1.570 +	echo -e "`gettext \"Installation complete. You can now restart (reboot) \"`"
   1.571 +	echo -e "`gettext \"from your SliTaz GNU/Linux system.\"`"
   1.572  	echo "=== Tazinst end at `date` ===" >>$LOG
   1.573  	# Log files
   1.574 -	echo "Copying log files ($LOG)..."
   1.575 +	echo -e "`gettext \"Copying log files ($LOG)...\"`"
   1.576  	cp -a $LOG $TARGET_ROOT/var/log
   1.577  	sleep 2
   1.578  	# umount
   1.579 @@ -1002,7 +1002,7 @@
   1.580  	debug "Preparing the target partition..."
   1.581  	# Target may be used
   1.582  	mount | grep -q $TGT_PARTITION && \
   1.583 -		abort 5 $TGT_PARTITION": Partition in use"
   1.584 +		abort 5 `gettext "$TGT_PARTITION": Partition in use"`
   1.585  	# Mount point can be already used.
   1.586  	if mount | grep -q $TARGET_ROOT; then
   1.587  		umount $TARGET_ROOT 2>>$LOG
   1.588 @@ -1011,7 +1011,7 @@
   1.589  	# Mount target.
   1.590  	mount $TGT_PARTITION $TARGET_ROOT >>$LOG 2>>$LOG
   1.591  	if [ $(mount | grep -c "mnt/target") == "0" ]; then
   1.592 -		abort 5 "Can't mount $TGT_PARTITION"
   1.593 +		abort 5 `gettext "Can't mount $TGT_PARTITION"`
   1.594  	fi
   1.595  }
   1.596  
   1.597 @@ -1020,17 +1020,17 @@
   1.598  {
   1.599  	if [ -f $TARGET_ROOT/etc/slitaz-release ]; then
   1.600  		release=`cat $TARGET_ROOT/etc/slitaz-release`
   1.601 -		msg "Preparing upgrade of SliTaz release: $release"
   1.602 +		msg `gettext "Preparing upgrade of SliTaz release: $release"`
   1.603  	else
   1.604 -		abort 6 "The partition '$TGT_PARTITION' doesn't appear to contain \
   1.605 -a SliTaz system, the file: /etc/slitaz-release doesn't exist."
   1.606 +		abort 6 `gettext "The partition '$TGT_PARTITION' doesn't appear to contain \
   1.607 +a SliTaz system, the file: /etc/slitaz-release doesn't exist."`
   1.608  	fi && sleep 2
   1.609  }
   1.610  
   1.611  # Backup target packages list.
   1.612  backup_files()
   1.613  {
   1.614 -	cd $TARGET_ROOT || abort 8 "Internal"
   1.615 +	cd $TARGET_ROOT || abort 8 `gettext "Internal"`
   1.616  	ls -1 var/lib/tazpkg/installed > home/packages-selection.list
   1.617  	for dir in *
   1.618  	do
   1.619 @@ -1127,7 +1127,7 @@
   1.620  # Search for added pkgs
   1.621  update_pkgs()
   1.622  {
   1.623 -	cd $TARGET_ROOT/var/lib/tazinst || abort 8 "Internal"
   1.624 +	cd $TARGET_ROOT/var/lib/tazinst || abort 8 `gettext "Internal"`
   1.625  	# LiveCD packages list.
   1.626  	debug "Creating package lists..."
   1.627  	ls -1 $TARGET_ROOT/var/lib/tazpkg/installed > packages-source.list || exit 1
   1.628 @@ -1142,10 +1142,10 @@
   1.629  		install_pkgs
   1.630  	else
   1.631  		touch packages-to-install.list
   1.632 -		warning "The list of available packages on the mirror could not be \
   1.633 +		warning `gettext "The list of available packages on the mirror could not be \
   1.634  downloaded. No missing packages will be reinstalled now, but \
   1.635  you can do so later by looking at the following list: \
   1.636 -/var/lib/tazinst/packages-selection.diff"
   1.637 +/var/lib/tazinst/packages-selection.diff"`
   1.638  	fi
   1.639  	sleep 2
   1.640  }
   1.641 @@ -1155,7 +1155,7 @@
   1.642  {
   1.643  	# Backup and create a new grub menu.lst.
   1.644  	if [ "$TGT_GRUB" == "yes" ]; then
   1.645 -		msg "Grub update"
   1.646 +		msg `gettext "Grub update"`
   1.647  		mv $TARGET_ROOT/boot/grub/menu.lst \
   1.648  			$TARGET_ROOT/boot/grub/menu.lst.bak 2>/dev/null
   1.649  		grub_config
   1.650 @@ -1168,15 +1168,15 @@
   1.651  {
   1.652  	# saving pwd
   1.653  	local save_pwd=$(pwd)
   1.654 -	cd $TARGET_ROOT || abort 8 "Internal"
   1.655 +	cd $TARGET_ROOT || abort 8 `gettext "Internal"`
   1.656  
   1.657  	debug "Searching for /etc/slitaz-release"
   1.658  	check_release
   1.659  
   1.660 -	msg "Backup /etc, /home and the packages list..."
   1.661 +	msg `gettext "Backup /etc, /home and the packages list..."`
   1.662  	backup_files
   1.663  
   1.664 -	msg "Upgrading SliTaz on $TGT_PARTITION"
   1.665 +	msg `gettext "Upgrading SliTaz on $TGT_PARTITION"`
   1.666  
   1.667  	debug "Copying the bootloader syslinux/isolinux..."
   1.668  	copy_bootloaders
   1.669 @@ -1184,13 +1184,13 @@
   1.670  	debug "Extracting the root system..."
   1.671  	extract_rootfs $SOURCE_ROOT/boot
   1.672  
   1.673 -	msg "Restoring configuration files..."
   1.674 +	msg `gettext "Restoring configuration files..."`
   1.675  	restore_files
   1.676  
   1.677  	debug "Installing the kernel..."
   1.678  	install_kernel
   1.679  
   1.680 -	msg "Upgrading added packages..."
   1.681 +	msg `gettext "Upgrading added packages..."`
   1.682  	update_pkgs
   1.683  
   1.684  	# restoring pwd
   1.685 @@ -1202,10 +1202,9 @@
   1.686  {
   1.687  	pkgscd=`cat $TARGET_ROOT/var/lib/tazinst/packages-source.list | wc -l`
   1.688  	pkginst=`cat $TARGET_ROOT/var/lib/tazinst/packages-to-install.list | wc -l`
   1.689 -	echo -e "Upgrade finished. You can now restart (reboot) \
   1.690 -from your SliTaz GNU/Linux system.
   1.691 -Packages on the cdrom : $pkgscd
   1.692 -Packages installed from the mirror : $pkginst"
   1.693 +	echo -e "`gettext \"Upgrade finished. You can now restart (reboot) from your SliTaz GNU/Linux system.\"`"
   1.694 +	echo -e "`gettext \"Packages on the cdrom :\"`" $pkgscd
   1.695 +	echo -e "`gettext \"Packages installed from the mirror :\"`" $pkginst
   1.696  	echo "=== Tazinst end at `date` ===" >>$LOG
   1.697  	umount_devices
   1.698  }