slitaz-tools diff installer/tazinst @ rev 658

tazinst: some i18n and misc fixes
author Dominique Corbex <domcox@slitaz.org>
date Sun Jul 31 10:32:56 2011 +0200 (2011-07-31)
parents 9ec8aeb6a41f
children 56ee2e6e63af
line diff
     1.1 --- a/installer/tazinst	Wed Jul 27 10:30:45 2011 +0200
     1.2 +++ b/installer/tazinst	Sun Jul 31 10:32:56 2011 +0200
     1.3 @@ -19,7 +19,7 @@
     1.4  # 6: SliTaz system to upgrade not found
     1.5  # 8: Internal error
     1.6  
     1.7 -VERSION=3.11
     1.8 +VERSION=3.20
     1.9  
    1.10  # Internationalization
    1.11  . /usr/bin/gettext.sh
    1.12 @@ -53,7 +53,7 @@
    1.13  	echo -e "install       `gettext \"Install SliTaz on HDD using a configuration file.\"`"
    1.14  	echo -e "upgrade       `gettext \"Upgrade SliTaz on HDD using a configuration file.\"`"
    1.15  	echo -e "config        `gettext \"Generate a configuration file.\"`"
    1.16 -	echo -e "check         `gettext \"Check configuration file validity.\"`"
    1.17 +	echo -e "check         `gettext \"Check validity of the configuration file.\"`"
    1.18  	echo -e "showurl       `gettext \"Show the full URL of a predefined URL (stable|cooking|rolling).\"`"
    1.19  	echo -e "cli           `gettext \"Install or upgrade using command line options:\"`"
    1.20  	echo -e "  -i             `gettext \"Full Install (not upgrading, all present data will be lost).\"`"
    1.21 @@ -81,7 +81,6 @@
    1.22  		umount $TARGET_ROOT 2>>$LOG
    1.23  	fi
    1.24  	echo -e "`gettext \"Error\"` $@"
    1.25 -#	echo -e "`gettext \"Installation cancelled\"`"
    1.26  	test $(id -u) = 0 && echo "Installation cancelled on error $@" >> $LOG
    1.27  	exit $1
    1.28  }
    1.29 @@ -115,7 +114,7 @@
    1.30  gen_config()
    1.31  {
    1.32  	CONFILE=$1
    1.33 -	touch $CONFILE || abort 2 `gettext "Unable to write to $CONFILE"`
    1.34 +	touch $CONFILE || abort 2 `gettext "Can't write config file"`
    1.35  	if [ -r "$CONFILE" ]; then
    1.36  		cat > $CONFILE << _EOF_
    1.37  # tazinst.conf: SliTaz Installer configuration file.
    1.38 @@ -174,7 +173,7 @@
    1.39  _EOF_
    1.40  
    1.41  	else
    1.42 -		abort 2 `gettext "Configuration file $CONFILE not found"`
    1.43 +		abort 2 `gettext "Config file not found"`
    1.44  	fi
    1.45  }
    1.46  
    1.47 @@ -211,9 +210,9 @@
    1.48  			debug "Using config-file=$CONFILE"
    1.49  			# source doesn't like file without a path
    1.50  			[ $(echo "$CONFILE" | grep -c "/") == "0" ] && CONFILE="./$CONFILE"
    1.51 -			source $CONFILE || abort 2 `gettext "Unable to read $CONFILE"`
    1.52 +			source $CONFILE || abort 2 `gettext "Unable to read config file"`
    1.53  		else
    1.54 -			abort 2 `gettext "Configuration file not found"`
    1.55 +			abort 2 `gettext "Config file not found"`
    1.56  		fi
    1.57  	else
    1.58  		abort 2 `gettext "No configuration file provided"`
    1.59 @@ -246,7 +245,7 @@
    1.60  	INST_ACTION="$INSTALL$UPGRADE"
    1.61  	# Don't allow formatting on upgrades
    1.62  	[ "$INST_ACTION" == "upgrade" ] && [ -n "$TGT_FS" ] && \
    1.63 -		warning `gettext "Partition $TGT_PARTITION will not be formatted during upgrade"`
    1.64 +		warning "$TGT_PARTITION: `gettext "will not be formatted during upgrade"`"
    1.65  }
    1.66  
    1.67  # check main vars
    1.68 @@ -276,7 +275,7 @@
    1.69  	# Check Action
    1.70  	case $INST_ACTION in
    1.71  		install|upgrade|check) ;;
    1.72 -		*) msg `gettext "INST_ACTION=$INST_ACTION: Invalid setting"`; error=yes ;;
    1.73 +		*) msg "INST_ACTION=$INST_ACTION: `gettext "Invalid setting"`"; error=yes ;;
    1.74  	esac
    1.75  
    1.76  	# Check Type
    1.77 @@ -285,9 +284,9 @@
    1.78  		usb|iso|web)
    1.79  			# We need a valid source 
    1.80  			if [ -z "$SRC_FILE" ]; then
    1.81 -				msg `gettext "Type is $INST_TYPE, but INST_SOURCE is not set"`; error=yes
    1.82 +				msg "INST_TYPE=$INST_TYPE,`gettext "but SRC_FILE is not set"`"; error=yes
    1.83  			fi ;;
    1.84 -		*) msg `gettext "INST_TYPE=$INST_TYPE: Invalid setting"`; error=yes ;;
    1.85 +		*) msg "INST_TYPE=$INST_TYPE: `gettext "Invalid setting"`"; error=yes ;;
    1.86  	esac
    1.87  
    1.88  	# Check Source file
    1.89 @@ -301,11 +300,11 @@
    1.90  	case $INST_TYPE in
    1.91  		iso)
    1.92  			if [ ! -r "$SRC_FILE" ]; then
    1.93 -				msg `gettext "SRC_FILE=$SRC_FILE: file not found"`; error=yes
    1.94 +				msg "SRC_FILE=$SRC_FILE: `gettext "file not found"`"; error=yes
    1.95  			fi ;;
    1.96  		web)
    1.97  			if ! wget -sq "$SRC_FILE" 2> /dev/null ; then
    1.98 -				msg `gettext "SRC_FILE=$SRC_FILE: file not found on the web"`; error=yes
    1.99 +				msg "SRC_FILE=$SRC_FILE: `gettext "file not found on the web"`"; error=yes
   1.100  			fi ;;
   1.101  	esac
   1.102  
   1.103 @@ -316,7 +315,7 @@
   1.104  		[ "$partition" == "$TGT_PARTITION" ] && found="yes"
   1.105  	done
   1.106  	if [ "$found" != "yes" ]; then
   1.107 -		msg `gettext "TGT_PARTITION=$TGT_PARTITION Partition not found"`; error=yes
   1.108 +		msg "TGT_PARTITION=$TGT_PARTITION: `gettext "Partition not found"`"; error=yes
   1.109  	fi
   1.110  
   1.111  	# Check Filesystem
   1.112 @@ -328,9 +327,9 @@
   1.113  				[ -x "$xdir/mkfs.$TGT_FS" ] && found=yes
   1.114  			done
   1.115  			if [ "$found" == "no" ]; then
   1.116 -				msg `gettext "$TGT_FS: mkfs.$TGT_FS is not installed."`; error=yes
   1.117 +				msg "$TGT_FS: mkfs.$TGT_FS `gettext "is not installed."`"; error=yes
   1.118  			fi ;;
   1.119 -		*) msg `gettext "TGT_FS=$TGT_FS: Unknown filesystem"`; error=yes ;;
   1.120 +		*) msg "TGT_FS=$TGT_FS: `gettext "Unknown filesystem"`"; error=yes ;;
   1.121  	esac
   1.122  
   1.123  	# Check Home partition
   1.124 @@ -340,7 +339,7 @@
   1.125  			[ "$partition" == "$TGT_HOME" ] && found=yes
   1.126  		 done
   1.127  		if [ "$found" != "yes" ]; then
   1.128 -			msg `gettext "TGT_HOME=$TGT_HOME: Partition not found"`; error=yes
   1.129 +			msg "TGT_HOME=$TGT_HOME: `gettext "Partition not found"`"; error=yes
   1.130  		fi
   1.131  	fi
   1.132  
   1.133 @@ -353,15 +352,15 @@
   1.134  				[ -x "$xdir/mkfs.$TGT_FS" ] && found=yes
   1.135  			done
   1.136  			if [ "$found" == "no" ]; then
   1.137 -				msg `gettext "$TGT_FS: mkfs.$TGT_FS is not installed."`; error=yes
   1.138 +				msg "$TGT_FS: mkfs.$TGT_FS `gettext "is not installed."`"; error=yes
   1.139  			fi ;;
   1.140 -		*) msg `gettext "TGT_HOME_FS=$TGT_HOME_FS: unknown filesystem"`; error=yes ;;
   1.141 +		*) msg "TGT_HOME_FS=$TGT_HOME_FS: `eval_gettext "Unknown filesystem"`"; error=yes ;;
   1.142  	esac
   1.143  
   1.144  	# Check Grub
   1.145  	case $TGT_GRUB in
   1.146  		yes|no) ;;
   1.147 -		*) msg `gettext "TGT_GRUB=$TGT_GRUB: Invalid setting"`; error=yes ;;
   1.148 +		*) msg "TGT_GRUB=$TGT_GRUB: `eval_gettext "Invalid setting"`"; error=yes ;;
   1.149  	esac
   1.150  
   1.151  	# Check Winboot
   1.152 @@ -369,7 +368,7 @@
   1.153  		"") ;;
   1.154  		auto) ;;
   1.155  		hd[[:digit:]],[[:digit:]]) ;;
   1.156 -		*) msg `gettext "TGT_WINBOOT=$TGT_WINBOOT: Invalid format"`; error=yes ;;
   1.157 +		*) msg "TGT_WINBOOT=$TGT_WINBOOT: `eval_gettext "Invalid format"`"; error=yes ;;
   1.158  	esac
   1.159  
   1.160  	# Stop on error
   1.161 @@ -397,7 +396,7 @@
   1.162  		debug "Using files from cdrom ($CDROM)..."
   1.163  		sleep 2
   1.164  	else
   1.165 -		warning `gettext "Failed to mount $CDROM"`
   1.166 +		warning "$CDROM: `gettext "Failed to mount"`"
   1.167  	fi
   1.168  }
   1.169  
   1.170 @@ -416,7 +415,7 @@
   1.171  			debug "Using files from USB device ($SRC_FILE)..."
   1.172  			SOURCE_STATUS="mount"
   1.173  		else
   1.174 -			warning `gettext "Failed to mount USB device $SRC_FILE"`
   1.175 +			warning "$SRC_FILE: `gettext "Failed to mount USB device"`"
   1.176  		fi
   1.177  	fi
   1.178  }
   1.179 @@ -429,16 +428,16 @@
   1.180  	src_md5=$(echo $SRC_FILE | sed 's/.iso$/.md5/')
   1.181  	if [ -r "$src_md5" ]; then
   1.182  		[ $(md5sum $SRC_FILE | cut -d' ' -f1) == $(cat "$src_md5" | cut -d' ' -f1) ] || \
   1.183 -			abort 3 `gettext "$SRC-FILE corrupted"`
   1.184 +			abort 3 "$SRC-FILE `gettext "corrupted"`"
   1.185  	else
   1.186 -		warning `gettext "$src_md5 not found, unable to check integrity of $SRC_FILE"`
   1.187 +		warning "$SRC_FILE: `gettext "md5 file not found, unable to check integrity."`"
   1.188  	fi
   1.189  	# Try to mount ISO
   1.190  	if mount -o loop -t iso9660 $SRC_FILE $SOURCE_ROOT 2>>$LOG; then
   1.191  		debug "Using files from ISO ($SRC_FILE)..."
   1.192  		sleep 2
   1.193  	else
   1.194 -		warning `gettext "Failed to mount ISO '$SRC_FILE'"`
   1.195 +		warning "$SRC_FILE: `gettext "Failed to mount ISO."`"
   1.196  	fi
   1.197  }
   1.198  
   1.199 @@ -450,11 +449,11 @@
   1.200  	if wget $SRC_FILE -P /tmp; then
   1.201  		debug "Download completed."
   1.202  	else
   1.203 -		warning `gettext "Failed to download '$SRC_FILE'"`
   1.204 +		warning "$SRC_FILE: `gettext "Failed to download."`"
   1.205  	fi
   1.206  	src_md5=$(echo $SRC_FILE | sed 's/.iso$/.md5/')
   1.207  	debug "Downloading $src_md5"
   1.208 -	wget $src_md5 -P /tmp || warning `gettext "Failed to download '$src_md5'"`
   1.209 +	wget $src_md5 -P /tmp || warning "$src_md5: `eval_gettext "Failed to download."`"
   1.210  	tmpfile=$(echo $SRC_FILE | awk 'BEGIN{RS="/"}{out=$1}END{printf"%s",out}')
   1.211  	SRC_FILE="/tmp/$tmpfile"
   1.212  	check_iso
   1.213 @@ -512,24 +511,24 @@
   1.214  
   1.215  	if [ "$INST_ACTION" == "install" ]; then
   1.216  		if [ -n "$TGT_FS" ]; then
   1.217 -			msg `gettext "Format root partition '$TGT_PARTITION' ($TGT_FS)"`
   1.218 +			msg "`gettext "Format root partition"` '$TGT_PARTITION' ($TGT_FS)"
   1.219  		fi
   1.220  		if [ -n "$TGT_HOME_FS" ]; then
   1.221 -			msg `gettext "Format /home partition '$TGT_HOME' ($TGT_HOME_FS)"`
   1.222 +			msg "`gettext "Format /home partition"` '$TGT_HOME' ($TGT_HOME_FS)"
   1.223  		fi	
   1.224 -		msg `gettext "Install SliTaz on '$TGT_PARTITION' from $INST_TYPE"`
   1.225 -		[ -n "$TGT_HOME" ] && msg `gettext "Set Home partition to '$TGT_HOME'"`
   1.226 -		msg `gettext "Set Hostname as '$TGT_HOSTNAME'"`
   1.227 -		msg `gettext "Set Default user as '$TGT_USER'"`
   1.228 +		msg "`gettext "Install SliTaz on"` '$TGT_PARTITION'. `gettext "Source:"` $INST_TYPE"
   1.229 +		[ -n "$TGT_HOME" ] && msg "`gettext "Set Home partition to" `'$TGT_HOME'"
   1.230 +		msg "`gettext "Set Hostname as"` '$TGT_HOSTNAME'"
   1.231 +		msg "`gettext "Set Default user as"` '$TGT_USER'"
   1.232  	else
   1.233 -		msg `gettext "Check '$TGT_PARTITION'"`
   1.234 +		msg "`gettext "Check"` '$TGT_PARTITION'"
   1.235  		msg `gettext "Backup /etc, /home and the packages list"`
   1.236 -		msg `gettext "Upgrade SliTaz on '$TGT_PARTITION' from $INST_TYPE"`
   1.237 +		msg "`gettext "Upgrade SliTaz on"` '$TGT_PARTITION'. `gettext "Source:"` $INST_TYPE"
   1.238  		msg `gettext "Restore /etc, /home"`
   1.239  		msg `gettext "Upgrade additional packages."`
   1.240  	fi
   1.241  	if [ -n "$TGT_WINBOOT" ]; then
   1.242 -		msg `gettext "Enable Windows dual-boot ($TGT_WINBOOT)"`
   1.243 +		msg "`gettext "Enable Windows dual-boot"` ($TGT_WINBOOT)"
   1.244  	fi
   1.245  	if [ "$TGT_GRUB" == "yes" ]; then
   1.246  		msg `gettext "Install Grub"`
   1.247 @@ -554,7 +553,7 @@
   1.248  	debug "Preparing target partition..."
   1.249  	# Target may be used
   1.250  	mount | grep -q $TGT_PARTITION && \
   1.251 -		abort 5 `gettext $TGT_PARTITION": Partition in use"`
   1.252 +		abort 5 "$TGT_PARTITION: `gettext "Partition in use"`"
   1.253  	# Mount point can be already used.
   1.254  	if mount | grep -q $TARGET_ROOT; then
   1.255  		umount $TARGET_ROOT 2>>$LOG
   1.256 @@ -568,7 +567,7 @@
   1.257  #			ROOT_FS=$(parted /dev/hda5 print -m | grep "^1:" | cut -d':' -f5) ;;
   1.258  			ROOT_FS=auto ;;
   1.259  		*)
   1.260 -			msg `gettext "Formatting $TGT_PARTITION ($TGT_FS)"`
   1.261 +			msg "`gettext "Formatting main partition:"` $TGT_PARTITION ($TGT_FS)"
   1.262  			mkfs.$TGT_FS $TGT_PARTITION >>$LOG 2>>$LOG
   1.263  			ROOT_FS=$TGT_FS ;;
   1.264  	esac
   1.265 @@ -580,7 +579,7 @@
   1.266  			"")
   1.267  				debug "The partition ($TGT_HOME) will be kept..." ;;
   1.268  			*)
   1.269 -				msg `gettext "Formatting /home on $TGT_HOME ($TGT_HOME_FS)"`
   1.270 +				msg "`gettext "Formatting /home partition:"` $TGT_HOME ($TGT_HOME_FS)"
   1.271  				mkfs.$TGT_HOME_FS -L "Home" $TGT_HOME >>$LOG 2>>$LOG ;;
   1.272  		esac
   1.273  		sleep 2
   1.274 @@ -593,7 +592,7 @@
   1.275  
   1.276  	mount -t $ROOT_FS $TGT_PARTITION $TARGET_ROOT >>$LOG 2>>$LOG
   1.277  	if [ $(mount | grep -c "mnt/target") == "0" ]; then
   1.278 -		abort 5 `gettext "Can't mount $TGT_PARTITION"`
   1.279 +		abort 5 "$TGT_PARTITION: `gettext "Can't mount"`"
   1.280  	fi
   1.281  }
   1.282  
   1.283 @@ -747,7 +746,7 @@
   1.284  	sed -i s#'CHECK_FS=\"\"'#"CHECK_FS=\"$TGT_PARTITION\""# etc/rcS.conf
   1.285  	sleep 2
   1.286  	# Set hostname.
   1.287 -	msg `gettext "Configuring host name: $TGT_HOSTNAME"`
   1.288 +	msg "`gettext "Configuring host name:"` $TGT_HOSTNAME"
   1.289  	echo $TGT_HOSTNAME > etc/hostname
   1.290  }
   1.291  
   1.292 @@ -914,7 +913,7 @@
   1.293  # Files install, calling for functions or with cmds.
   1.294  install_files()
   1.295  {
   1.296 -	msg `gettext "Installing SliTaz on $TGT_PARTITION"`
   1.297 +	msg "`gettext "Installing SliTaz on"` $TGT_PARTITION"
   1.298  	# saving pwd
   1.299  	local save_pwd=$(pwd)
   1.300  
   1.301 @@ -933,11 +932,11 @@
   1.302  	debug "Preconfiguring the system..."
   1.303  	pre_config_system
   1.304  
   1.305 -	msg `gettext "Configuring root and default $TGT_USER account..."`
   1.306 +	msg "`gettext "Configuring root and default user account:"` $TGT_USER"
   1.307  	users_settings
   1.308  
   1.309  	if [ "$TGT_HOME" != "" ]; then
   1.310 -		msg `gettext "Configuring $TGT_HOME to be used as /home..."`
   1.311 +		msg "$TGT_HOME: `gettext "Configuring partition to be used as /home..."`"
   1.312  		home_config
   1.313  		sleep 2
   1.314  	fi
   1.315 @@ -956,7 +955,7 @@
   1.316  {
   1.317  	if [ "$TGT_GRUB" == "yes" ]; then
   1.318  		TARGET_DISK=`echo $TGT_PARTITION | sed s/"[0-9]"/''/`
   1.319 -		msg `gettext "Running grub-install on : $TARGET_DISK"`
   1.320 +		msg "`gettext "Running grub-install on:"` $TARGET_DISK"
   1.321  		grub-install --no-floppy \
   1.322  				--root-directory=$TARGET_ROOT $TARGET_DISK 2>>$LOG
   1.323  		debug "Grub installation done..."
   1.324 @@ -970,13 +969,13 @@
   1.325  {
   1.326  	# Umount target
   1.327  	if mount | grep -q $TARGET_ROOT; then
   1.328 -		echo -e "`gettext \"Unmounting target ($TGT_PARTITION)...\"`"
   1.329 +		echo -e "`gettext \"Unmounting target\"` ($TGT_PARTITION)..."
   1.330  	umount $TARGET_ROOT 2>>$LOG
   1.331  	fi
   1.332  
   1.333  	# Umount source
   1.334  	if mount | grep -q $SOURCE_ROOT; then
   1.335 -		echo -e "`gettext \"Unmounting $SOURCE_ROOT\"`"
   1.336 +		echo -e "`gettext \"Unmounting\"` $SOURCE_ROOT"
   1.337  		umount $SOURCE_ROOT
   1.338  	fi
   1.339  
   1.340 @@ -995,7 +994,7 @@
   1.341  	echo -e "`gettext \"from your SliTaz GNU/Linux system.\"`"
   1.342  	echo "=== Tazinst end at `date` ===" >>$LOG
   1.343  	# Log files
   1.344 -	echo -e "`gettext \"Copying log files ($LOG)...\"`"
   1.345 +	echo -e "`gettext \"Copying log files\"` ($LOG)..."
   1.346  	cp -a $LOG $TARGET_ROOT/var/log
   1.347  	sleep 2
   1.348  	# umount
   1.349 @@ -1012,7 +1011,7 @@
   1.350  	debug "Preparing the target partition..."
   1.351  	# Target may be used
   1.352  	mount | grep -q $TGT_PARTITION && \
   1.353 -		abort 5 `gettext "$TGT_PARTITION": Partition in use"`
   1.354 +		abort 5 "$TGT_PARTITION: `gettext "Partition in use"`"
   1.355  	# Mount point can be already used.
   1.356  	if mount | grep -q $TARGET_ROOT; then
   1.357  		umount $TARGET_ROOT 2>>$LOG
   1.358 @@ -1021,7 +1020,7 @@
   1.359  	# Mount target.
   1.360  	mount $TGT_PARTITION $TARGET_ROOT >>$LOG 2>>$LOG
   1.361  	if [ $(mount | grep -c "mnt/target") == "0" ]; then
   1.362 -		abort 5 `gettext "Can't mount $TGT_PARTITION"`
   1.363 +		abort 5 "$TGT_PARTITION `gettext "Can't mount"`"
   1.364  	fi
   1.365  }
   1.366  
   1.367 @@ -1030,10 +1029,10 @@
   1.368  {
   1.369  	if [ -f $TARGET_ROOT/etc/slitaz-release ]; then
   1.370  		release=`cat $TARGET_ROOT/etc/slitaz-release`
   1.371 -		msg `gettext "Preparing upgrade of SliTaz release: $release"`
   1.372 +		msg "`gettext "Preparing upgrade of SliTaz release:"` $release"
   1.373  	else
   1.374 -		abort 6 `gettext "The partition '$TGT_PARTITION' doesn't appear to contain \
   1.375 -a SliTaz system, the file: /etc/slitaz-release doesn't exist."`
   1.376 +		abort 6 "'$TGT_PARTITION': `gettext "This partition doesn't appear to contain \
   1.377 +a valid SliTaz system, the file: /etc/slitaz-release doesn't exist."`"
   1.378  	fi && sleep 2
   1.379  }
   1.380  
   1.381 @@ -1186,7 +1185,7 @@
   1.382  	msg `gettext "Backup /etc, /home and the packages list..."`
   1.383  	backup_files
   1.384  
   1.385 -	msg `gettext "Upgrading SliTaz on $TGT_PARTITION"`
   1.386 +	msg "`gettext "Upgrading SliTaz on:"` $TGT_PARTITION"
   1.387  
   1.388  	debug "Copying the bootloader syslinux/isolinux..."
   1.389  	copy_bootloaders