tazinst diff installer.cgi @ rev 2

Use UUIDs, boot delay on mobile disks, GPT support, boot flag, new slitaz-installer and web frontends
author Dominique Corbex <domcox@slitaz.org>
date Thu Feb 14 13:12:12 2013 +0100 (2013-02-14)
parents ced519734730
children e62babb3966d
line diff
     1.1 --- a/installer.cgi	Thu Feb 14 12:48:04 2013 +0100
     1.2 +++ b/installer.cgi	Thu Feb 14 13:12:12 2013 +0100
     1.3 @@ -2,528 +2,559 @@
     1.4  #
     1.5  # Main CGI interface for Tazinst, the SliTaz installer.
     1.6  #
     1.7 -# Copyright (C) 2012 SliTaz GNU/Linux - BSD License
     1.8 +# Copyright (C) 2012-2013 SliTaz GNU/Linux - BSD License
     1.9  #
    1.10  # Authors : Dominique Corbex <domcox@slitaz.org>
    1.11  #
    1.12  
    1.13 -VERSION=0.30
    1.14  
    1.15 -# Common functions from libtazpanel
    1.16 -. lib/libtazpanel
    1.17 -header
    1.18 -get_config
    1.19 +# restricted path
    1.20 +PATH="/usr/sbin:/usr/bin:/sbin:/bin"
    1.21  
    1.22 -# Include gettext helper script.
    1.23 +VERSION=3.90
    1.24 +
    1.25 +# panel location and theme
    1.26 +PANEL="/var/www/tazpanel"
    1.27 +STYLE="default"
    1.28 +
    1.29 +# absolute paths to images
    1.30 +IMAGES="/styles/$STYLE/images"
    1.31 +
    1.32 +# tazpanel config
    1.33 +[ -r /etc/slitaz/tazpanel.conf ] && . /etc/slitaz/tazpanel.conf
    1.34 +
    1.35 +# include gettext helper script.
    1.36  . /usr/bin/gettext.sh
    1.37  
    1.38 -# Export package name for gettext.
    1.39 -#TEXTDOMAIN='installer'
    1.40 -#export TEXTDOMAIN
    1.41 +# get parameters with GET, POST and FILE functions
    1.42 +. /usr/bin/httpd_helper.sh
    1.43  
    1.44 -TITLE=$(gettext 'TazPanel - Installer')
    1.45 +# export package name for gettext.
    1.46 +TEXTDOMAIN='installer'
    1.47 +export TEXTDOMAIN
    1.48  
    1.49 -# Tazinst required version
    1.50 -TAZINST_REQUIRED_VERSION="3.3"
    1.51 +# tazinst required version
    1.52 +TAZINST_MINIMUM_VERSION="3.8"
    1.53 +TAZINST_MAXIMUM_VERSION="4.99"
    1.54  
    1.55 -# Tazinst setup file
    1.56 -INSTFILE=/var/lib/tazinst.conf
    1.57 +# tazinst setup file
    1.58 +INSTFILE=/root/tazinst.conf
    1.59  
    1.60  
    1.61 -write_setup()
    1.62 -{
    1.63 -	if [ -e "$INSTFILE" ]; then
    1.64 -		# Install type
    1.65 -		INST_TYPE=$(GET INST_TYPE)
    1.66 -		# Source File
    1.67 -		case "$INST_TYPE" in
    1.68 -			usb)
    1.69 -				SRC_FILE=$(GET SRC_USB) ;;
    1.70 -			iso)
    1.71 -				SRC_FILE=$(GET SRC_ISO) ;;
    1.72 -			web)
    1.73 -				SRC_FILE=$(GET SRC_WEB) ;;
    1.74 -		esac
    1.75 -		SRC_FILE=$(echo "$SRC_FILE" | sed 's/\//\\\//'g)
    1.76 -		[ -n $(GET URL) ] && SRC_WEB=$(GET URL)
    1.77 -		# Main Partition
    1.78 -		TGT_PARTITION=$(echo "$(GET TGT_PARTITION)" | sed 's/\//\\\//'g)
    1.79 -		[ -n "$(GET MAIN_FMT)" ] && TGT_FS=$(GET MAIN_FS) || TGT_FS=""
    1.80 -		# Home Partition
    1.81 -		if [ -n "$(GET HOME_SELECT)" ] ; then
    1.82 -			TGT_HOME=$(echo "$(GET TGT_HOME)" | sed 's/\//\\\//'g)
    1.83 -			[ -n "$(GET HOME_FMT)" ] && TGT_HOME_FS=$(GET HOME_FS) || TGT_HOME_FS=""
    1.84 -		else
    1.85 -			TGT_HOME=""
    1.86 -			TGT_HOME_FS=""
    1.87 -		fi
    1.88 -		# Hostname
    1.89 -		TGT_HOSTNAME=$(GET TGT_HOSTNAME)
    1.90 -		# Root pwd
    1.91 -		TGT_ROOT_PWD=$(GET TGT_ROOT_PWD)
    1.92 -		# User Login
    1.93 -		TGT_USER=$(GET TGT_USER)
    1.94 -		# User Pwd
    1.95 -		TGT_USER_PWD=$(GET TGT_USER_PWD)
    1.96 -		# Grub
    1.97 -		TGT_GRUB=$(GET TGT_GRUB)
    1.98 -		[ "$TGT_GRUB" == "yes" ] || TGT_GRUB=no
    1.99 -		# Win Dual-Boot
   1.100 -		TGT_WINBOOT=$(GET TGT_WINBOOT)
   1.101 -
   1.102 -		# Save changes to INSTFILE
   1.103 -		sed -i s/"^INST_TYPE=.*"/"INST_TYPE=\"$INST_TYPE\"/" $INSTFILE
   1.104 -		sed -i s/"^SRC_FILE=.*"/"SRC_FILE=\"$SRC_FILE\"/" $INSTFILE
   1.105 -		sed -i s/"^TGT_PARTITION=.*"/"TGT_PARTITION=\"$TGT_PARTITION\"/" $INSTFILE
   1.106 -		sed -i s/"^TGT_FS=.*"/"TGT_FS=\"$TGT_FS\"/" $INSTFILE
   1.107 -		sed -i s/"^TGT_HOME=.*"/"TGT_HOME=\"$TGT_HOME\"/" $INSTFILE
   1.108 -		sed -i s/"^TGT_HOME_FS=.*"/"TGT_HOME_FS=\"$TGT_HOME_FS\"/" $INSTFILE
   1.109 -		sed -i s/"^TGT_HOSTNAME=.*"/"TGT_HOSTNAME=\"$TGT_HOSTNAME\"/" $INSTFILE
   1.110 -		sed -i s/"^TGT_ROOT_PWD=.*"/"TGT_ROOT_PWD=\"$TGT_ROOT_PWD\"/" $INSTFILE
   1.111 -		sed -i s/"^TGT_USER=.*"/"TGT_USER=\"$TGT_USER\"/" $INSTFILE
   1.112 -		sed -i s/"^TGT_USER_PWD=.*"/"TGT_USER_PWD=\"$TGT_USER_PWD\"/" $INSTFILE
   1.113 -		sed -i s/"^TGT_GRUB=.*"/"TGT_GRUB=\"$TGT_GRUB\"/" $INSTFILE
   1.114 -		sed -i s/"^TGT_WINBOOT=.*"/"TGT_WINBOOT=\"$TGT_WINBOOT\"/" $INSTFILE
   1.115 -	fi
   1.116 -}
   1.117 -
   1.118 -read_setup()
   1.119 -{
   1.120 -	# various checks on setup file
   1.121 -	if [ -e "$INSTFILE" ]; then
   1.122 -		# validity check + reformat output
   1.123 -		tazinst check $INSTFILE | awk '
   1.124 -BEGIN{
   1.125 -	fmt1="<span class=\"msg-nok\">"
   1.126 -	fmt2="<br /></span>"
   1.127 -	OFS=""
   1.128 -	}
   1.129 -{
   1.130 -	# make html compliant
   1.131 -	str=$0
   1.132 -	gsub(/\[1m/,"",str)
   1.133 -	gsub(/\[0m/,"",str)
   1.134 -	gsub(/\s/,"\\&nbsp;",str)
   1.135 -	gsub(/</,"\\&lt",str)
   1.136 -	gsub(/>/,"\\&gt",str)
   1.137 -	a[i++]=str
   1.138 -} END {
   1.139 -	{print fmt1,a[i-1],fmt2}
   1.140 -	{for (j=0; j<i-1;) print fmt1,substr(a[j++],3),fmt2}
   1.141 -}'
   1.142 -	else
   1.143 -		# no setup file found: creating
   1.144 -		eval_gettext 'Creating setup file $INSTFILE.'
   1.145 -		tazinst new $INSTFILE
   1.146 -		if [ ! -e "$INSTFILE" ]; then
   1.147 -			cat <<EOT
   1.148 -<span class="msg-nok">$(gettext 'Setup File Error')<br />
   1.149 -$(eval_gettext "The setup file <strong>\$INSTFILE</strong> doesn't \
   1.150 -exist.")</span><br />
   1.151 -EOT
   1.152 -		else
   1.153 -			if [ ! -r $INSTFILE ]; then
   1.154 -				cat <<EOT
   1.155 -<span class="msg-nok">$(gettext 'Setup File Error')<br />
   1.156 -$(eval_gettext "The setup file <strong>$INSTFILE</strong> is not readable. \
   1.157 -Check permissions and ownership.")</span><br />
   1.158 -EOT
   1.159 -			fi
   1.160 -		fi
   1.161 -	fi
   1.162 -	# read setup file
   1.163 -	. $INSTFILE
   1.164 -}
   1.165 +#-----------
   1.166 +# home page
   1.167 +#-----------
   1.168  
   1.169  select_action()
   1.170  {
   1.171 -	cat <<EOT
   1.172 -<div id="wrapper">
   1.173 -	<h2>$(gettext 'SliTaz Installer')</h2>
   1.174 -
   1.175 -<p>$(gettext "The SliTaz Installer installs or upgrades SliTaz to a hard disk \
   1.176 -drive from a device like a Live-CD or LiveUSB key, from a SliTaz ISO file, or \
   1.177 -from the web by downloading an ISO file.")</p>
   1.178 -</div>
   1.179 -EOT
   1.180 +	comment "welcome message"
   1.181 +	open_div_id "wrapper"
   1.182 +	h4 "$(gettext 'Welcome to the Slitaz Installer!')"
   1.183 +	p "$(gettext 'The SliTaz Installer installs or upgrades SliTaz to a
   1.184 +hard disk drive from a device like a Live-CD or LiveUSB key, from a SliTaz
   1.185 +ISO file, or from the web by downloading an ISO file.')"
   1.186 +	h5 "$(gettext "Which type of installation do you want to start?")"
   1.187 +	close_div
   1.188  }
   1.189  
   1.190  select_install()
   1.191  {
   1.192 -	cat <<EOT
   1.193 -<section>
   1.194 -	<h4>$(gettext 'Install')</h4>
   1.195 -
   1.196 -<p>$(gettext "Install SliTaz on a partition of your hard disk drive. If you \
   1.197 -decide to format your partition, all data will be lost. If you do not format, \
   1.198 -all data except for any existing /home directory will be removed (note the home \
   1.199 -directory contents will be kept as is).")</p>
   1.200 -
   1.201 -<p>$(gettext "Before installation, you may need to create or resize partitions \
   1.202 -on your hard disk drive in order to make space for SliTaz GNU/Linux. You can \
   1.203 -graphically manage your partitions with Gparted.")</p>
   1.204 -
   1.205 -<a class="button" href="$SCRIPT_NAME?page=partitioning">$(gettext "Install \
   1.206 -SliTaz") <img src="$IMAGES/go-next.png" /></a>
   1.207 -</section>
   1.208 -EOT
   1.209 +	comment "install message"
   1.210 +	open_div_class "box"
   1.211 +	h4 "$(gettext 'Install')"
   1.212 +	p "$(gettext 'Install SliTaz on a partition of your hard disk drive. If you
   1.213 +decide to format your partition, all data will be lost. If you do not
   1.214 +format, all data except for any existing /home directory will be removed,
   1.215 +the home directory will be kept as is.')"
   1.216 +	p "$(gettext 'Before installation, you may need to create or resize
   1.217 +partitions on your hard disk drive in order to make space for SliTaz
   1.218 +GNU/Linux. You can graphically manage your partitions with Gparted')"
   1.219 +	close_div
   1.220 +	button "install" "$(gettext "Install SliTaz")" \
   1.221 +		"$(gettext "Proceed to a new SliTaz installation")"
   1.222  }
   1.223  
   1.224  select_upgrade()
   1.225  {
   1.226 -	cat <<EOT
   1.227 -<section>
   1.228 -	<h4>$(gettext 'Upgrade')</h4>
   1.229 +	comment "upgrade message"
   1.230 +	open_div_class "box"
   1.231 +	h4 "$(gettext 'Upgrade')"
   1.232 +	p "$(gettext 'Upgrade an already installed SliTaz system on your hard disk
   1.233 +drive. Your /home /etc /var/www directories will be kept, all other
   1.234 +directories will be removed. Any additional packages added to your old
   1.235 +Slitaz system will be updated as long you have an active internet connection.')"
   1.236 +	close_div
   1.237 +	button "upgrade" "$(gettext 'Upgrade SliTaz')" \
   1.238 +		"$(gettext "Upgrade an existing SliTaz system")"
   1.239 +}
   1.240  
   1.241 -<p>$(gettext "Upgrade an already installed SliTaz system on your hard disk \
   1.242 -drive. Your /home /etc /var/www directories will be kept, all other \
   1.243 -directories will be removed. Any additional packages added to your old Slitaz \
   1.244 -system will be updated as long you have an active internet connection.")</p>
   1.245 +#--------------------
   1.246 +# partitionning page
   1.247 +#--------------------
   1.248  
   1.249 -<a class="button" href="$SCRIPT_NAME?page=upgrade">$(gettext "Upgrade \
   1.250 -SliTaz") <img src="$IMAGES/go-next.png" /></a>
   1.251 -</section>
   1.252 -EOT
   1.253 +exec_gparted()
   1.254 +{
   1.255 +	/bin/su - -c "exec env DISPLAY=':0.0' XAUTHORITY='/var/run/slim.auth' \
   1.256 +		/usr/sbin/gparted"
   1.257  }
   1.258  
   1.259  select_gparted()
   1.260  {
   1.261 -	cat <<EOT
   1.262 -<h4>$(gettext 'Partitioning')</h4>
   1.263 -<div class="box">
   1.264 -
   1.265 -<p>$(gettext "On most used systems, the hard drive is already dedicated to \
   1.266 -partitions for Windows<sup>&trade;</sup>, or Linux, or another operating \
   1.267 -system. You'll need to resize these partitions in order to make space for \
   1.268 -SliTaz GNU/Linux. SliTaz will co-exist with other operating systems already \
   1.269 -installed on your hard drive.")</p>
   1.270 -
   1.271 -<p>$(gettext "The amount of space needed depends on how much software you plan \
   1.272 -to install and how much space you require for users. It's conceivable that you \
   1.273 -could run a minimal SliTaz system in 300 megs or less, but 2 gigs is indeed \
   1.274 -more comfy.")</p>
   1.275 -
   1.276 -<p>$(gettext "A separate home partition, and a partition that will be used as \
   1.277 -Linux swap space may be created if needed. Slitaz detects and uses swap \
   1.278 -partitions automatically.")</p>
   1.279 -
   1.280 -</div>
   1.281 -
   1.282 -<div class="box">
   1.283 -
   1.284 -<p>$(gettext "You can graphically manage your partitions with Gparted. GParted \
   1.285 -is a partition editor for graphically managing your disk partitions. Gparted \
   1.286 -allows you to create, destroy, resize and copy partitions without data loss.")</p>
   1.287 -
   1.288 -<p>$(gettext "Gparted supports ext2, ext3, ext4, linux swap, ntfs and fat32 \
   1.289 -filesystems right out of the box. Support for xjs, jfs, hfs and other \
   1.290 -filesystems is available as well but you first need to add drivers for these \
   1.291 -filesystems by installing the related packages xfsprogs, jfsutils, linux-hfs \
   1.292 -and so on.")</p>
   1.293 -</div>
   1.294 -
   1.295 -<a class="button" href="$SCRIPT_NAME?page=gparted">$(gettext 'Execute Gparted')</a>
   1.296 -
   1.297 -<h5>$(gettext 'Continue installation')</h5>
   1.298 -
   1.299 -<p>$(gettext "Once you've made room for SliTaz on your drive, you should be \
   1.300 -able to continue installation.")
   1.301 -
   1.302 -<hr />
   1.303 -<a class="button" value="$1" href="$SCRIPT_NAME?page=home" >
   1.304 -	<img src="$IMAGES/go-first.png"/> $(gettext 'Back to Installer Start Page')</a>
   1.305 -<a class="button" value="$2" href="$SCRIPT_NAME?page=install">
   1.306 -	$(gettext 'Continue Installation') <img src="$IMAGES/go-next.png" /></a>
   1.307 -EOT
   1.308 +	comment "gparted message"
   1.309 +	h5 "$(gettext 'Partitioning')"
   1.310 +	open_div_class "box"
   1.311 +	p "$(gettext "On most used systems, the hard drive is already dedicated to
   1.312 +partitions for Windows<sup>&trade;</sup>, or Linux, or another operating
   1.313 +system. You'll need to resize these partitions in order to make space for
   1.314 +SliTaz GNU/Linux. SliTaz will co-exist with other operating systems already
   1.315 +installed on your hard drive.")"
   1.316 +	p "$(gettext "The amount of space needed depends on how much software you
   1.317 +plan to install and how much space you require for users. It's conceivable
   1.318 +that you could run a minimal SliTaz system in 300 megs or less, but 2 gigs
   1.319 +is indeed more comfy.")"
   1.320 +	p "$(gettext 'A separate home partition, and a partition that will be used
   1.321 +as Linux swap space may be created if needed. Slitaz detects and uses swap
   1.322 +partitions automatically.')"
   1.323 +	close_div
   1.324 +	open_div_class "box"
   1.325 +	p "$(gettext 'You can graphically manage your partitions with GParted.
   1.326 +GParted is a partition editor for graphically managing your disk partitions.
   1.327 +GParted allows you to create, destroy, resize and copy partitions without
   1.328 +data loss.')"
   1.329 +	p "$(gettext 'GParted supports ext2, ext3, ext4, linux swap, ntfs and fat32
   1.330 +filesystems right out of the box. Support for xjs, jfs, hfs and other
   1.331 +filesystems is available as well but you first need to add drivers for these
   1.332 +filesystems by installing the related packages xfsprogs, jfsutils, linux-hfs
   1.333 +and so on.')"
   1.334 +	close_div
   1.335 +	comment "launch GParted"
   1.336 +	button "gparted" "$(gettext 'Execute GParted')" \
   1.337 +		"$(gettext "Launch GParted, the partition editor tool")"
   1.338 +	h5 "$(gettext 'Continue installation')"
   1.339 +	p "$(gettext "Once you've made room for SliTaz on your drive, you should be
   1.340 +able to continue installation.")"
   1.341  }
   1.342  
   1.343 -display_action()
   1.344 +#------------
   1.345 +# input page
   1.346 +#------------
   1.347 +
   1.348 +
   1.349 +select_source()
   1.350  {
   1.351 -	case $1 in
   1.352 +	local media="$(/usr/sbin/tazinst get media "$INSTFILE")"
   1.353 +	local source="$(/usr/sbin/tazinst get source "$INSTFILE")"
   1.354 +	local list_media="$(/usr/sbin/tazinst list media)"
   1.355 +
   1.356 +	# default media
   1.357 +	[ "$media" ] || media="$(tazinst list media | cut -d ' ' -f1)"
   1.358 +	local error
   1.359 +	comment "source selection"
   1.360 +	# cdrom
   1.361 +	if printf "$list_media" | grep -q "cdrom"; then
   1.362 +		input_media "cdrom" "$media"
   1.363 +		label_media "cdrom" "$(gettext 'LiveCD')" "$media" \
   1.364 +		"$(gettext "Use the SliTaz LiveCD")"
   1.365 +		br
   1.366 +	fi
   1.367 +	# usb
   1.368 +	if printf "$list_media" | grep -q "usb"; then
   1.369 +		input_media "usb" "$media"
   1.370 +		label_media "usb" "$(gettext 'LiveUSB:')" "$media" \
   1.371 +		"$(gettext "Enter the partition where SliTaz Live is located on your \
   1.372 +USB Key")"
   1.373 +		error="$?"
   1.374 +		select "$(/usr/sbin/tazinst list usb "$INSTFILE")" "$source" "SRC_USB"
   1.375 +		error_msg "$error" "source" 2
   1.376 +		br
   1.377 +	fi
   1.378 +	# iso
   1.379 +	input_media "iso" "$media"
   1.380 +	label_media "iso" "$(gettext 'ISO file:')" "$media" \
   1.381 +	"$(gettext "Select a SliTaz ISO file located on a local disk")"
   1.382 +	error="$?"
   1.383 +	if [ "$media" == "iso" ]; then
   1.384 +		input "text" "src_iso" "$source" "" \
   1.385 +		"$(gettext 'Select an ISO or enter the full path to the ISO file')" \
   1.386 +			"iso"
   1.387 +	else
   1.388 +		input "text" "src_iso" "" "none" \
   1.389 +		"$(gettext 'Select an ISO or enter the full path to the ISO file')" \
   1.390 +			"iso"
   1.391 +	fi
   1.392 +	datalist "$(/usr/sbin/tazinst list iso "$INSTFILE")" "src_iso"
   1.393 +	error_msg "$error" "source"
   1.394 +	br
   1.395 +	# web
   1.396 +	input_media "web" "$media"
   1.397 +	label_media "web" "$(gettext 'Web:')" "$media" \
   1.398 +		"$(gettext "Select a SliTaz version on the Web")"
   1.399 +	error="$?"
   1.400 +
   1.401 +	if [ "$media" == "web" ]; then
   1.402 +		input "text" "src_web" "$source" "" \
   1.403 +		"$(gettext 'Select a version or enter the full url to an ISO file')" \
   1.404 +			"web"
   1.405 +	else
   1.406 +		input "text" "src_web" "" "none" \
   1.407 +		"$(gettext 'Select a version or enter the full url to an ISO file')" \
   1.408 +			"web"
   1.409 +	fi
   1.410 +	datalist "$(/usr/sbin/tazinst help web "$INSTFILE")" "src_web"
   1.411 +	error_msg "$error" "source"
   1.412 +}
   1.413 +
   1.414 +select_root_uuid()
   1.415 +{
   1.416 +	local root_uuid="$(/usr/sbin/tazinst get root_uuid "$INSTFILE")"
   1.417 +	local mode="$(/usr/sbin/tazinst get mode "$INSTFILE")"
   1.418 +	comment "root_uuid selection"
   1.419 +	if [ "$mode" == "upgrade" ]; then
   1.420 +		label "root_uuid" "$(gettext 'Existing SliTaz partition to upgrade:')" \
   1.421 +		"$(gettext "Specify the partition containing the system to upgrade")"
   1.422 +		error="$?"
   1.423 +	else
   1.424 +		label "root_uuid" "$(gettext 'Install Slitaz to partition:')" \
   1.425 +		"$(gettext "Specify the partition where to install SliTaz")"
   1.426 +		error="$?"
   1.427 +	fi
   1.428 +	select "$(/usr/sbin/tazinst list uuid "$INSTFILE")" "$root_uuid" \
   1.429 +		"ROOT_UUID" 2
   1.430 +	error_msg "$error" "root_uuid" 2
   1.431 +	br
   1.432 +}
   1.433 +
   1.434 +select_root_format()
   1.435 +{
   1.436 +	local root_format="$(/usr/sbin/tazinst get root_format "$INSTFILE")"
   1.437 +	comment "root_format selection"
   1.438 +	format "$(/usr/sbin/tazinst list format "$INSTFILE")" "$root_format" \
   1.439 +"ROOT_FORMAT"
   1.440 +}
   1.441 +
   1.442 +select_options()
   1.443 +{
   1.444 +	printf "<h4 id=\"options\">$(gettext 'Options')</h4>"
   1.445 +}
   1.446 +
   1.447 +select_home_uuid()
   1.448 +{
   1.449 +	local home_uuid="$(/usr/sbin/tazinst get home_uuid "$INSTFILE")"
   1.450 +	comment "home_uuid selection"
   1.451 +	h5 "$(gettext 'home partition')"
   1.452 +	label "home_uuid" "$(gettext 'Separate partition for /home:')" \
   1.453 +	"$(gettext "Specify the partition containing /home")"
   1.454 +	select "$(/usr/sbin/tazinst list uuid "$INSTFILE")" "$home_uuid" \
   1.455 +		"HOME_UUID" 2
   1.456 +	br
   1.457 +}
   1.458 +
   1.459 +select_home_format()
   1.460 +{
   1.461 +	local home_format="$(/usr/sbin/tazinst get home_format "$INSTFILE")"
   1.462 +	comment "home_format selection"
   1.463 +	format "$(/usr/sbin/tazinst list format "$INSTFILE")" "$home_format" \
   1.464 +"HOME_FORMAT"
   1.465 +}
   1.466 +
   1.467 +select_hostname()
   1.468 +{
   1.469 +	local hostname="$(/usr/sbin/tazinst get hostname "$INSTFILE")" error
   1.470 +	comment "hostname selection"
   1.471 +	h5 "$(gettext 'Hostname')"
   1.472 +	label "hostname" "$(gettext 'Set Hostname to:')" \
   1.473 +	"$(gettext "Hostname configuration allows you to specify the machine name")"
   1.474 +	error=$?
   1.475 +	input "text" "HOSTNAME" "$hostname" "" "$(gettext 'Name of your system')"
   1.476 +	error_msg "$error" "hostname" 2
   1.477 +}
   1.478 +
   1.479 +select_root_pwd()
   1.480 +{
   1.481 +	local root_pwd="$(/usr/sbin/tazinst get root_pwd "$INSTFILE")" error
   1.482 +	comment "root_pwd selection"
   1.483 +	h5 "$(gettext 'Root superuser')"
   1.484 +	label "root_pwd" "$(gettext 'Root passwd:')" \
   1.485 +	"$(gettext "Enter the password for root")"
   1.486 +	error="$?"
   1.487 +	input "text" "ROOT_PWD" "$root_pwd" "" "$(gettext 'Password of root')"
   1.488 +	error_msg "$error" "root_pwd"
   1.489 +}
   1.490 +
   1.491 +select_user_login()
   1.492 +{
   1.493 +	local user_login="$(/usr/sbin/tazinst get user_login "$INSTFILE")" error
   1.494 +	comment "user_login selection"
   1.495 +	h5 "$(gettext 'User')"
   1.496 +	label "user_login" "$(gettext 'User login:')" \
   1.497 +	"$(gettext "Enter the name of the first user")"
   1.498 +	error="$?"
   1.499 +	input "text" "USER_LOGIN" "$user_login" "" \
   1.500 +		"$(gettext 'Name of the first user')"
   1.501 +	error_msg "$error" "user_login" 2
   1.502 +	br
   1.503 +}
   1.504 +
   1.505 +select_user_pwd()
   1.506 +{
   1.507 +	local user_pwd="$(/usr/sbin/tazinst get user_pwd "$INSTFILE")" error
   1.508 +	label "user_pwd" "$(gettext 'User passwd:')" \
   1.509 +		"$(gettext "The password for default user")"
   1.510 +	error="$?"
   1.511 +	input "text" "USER_PWD" "$user_pwd" "" \
   1.512 +		"$(gettext 'Password of the first user')"
   1.513 +	error_msg "$error" "user_pwd"
   1.514 +}
   1.515 +
   1.516 +select_bootloader()
   1.517 +{
   1.518 +	local bootloader="$(/usr/sbin/tazinst get bootloader "$INSTFILE")" error
   1.519 +	comment "bootloader selection"
   1.520 +	h5 "$(gettext 'Bootloader')"
   1.521 +	input "checkbox" "bootloader" "auto" "$bootloader"
   1.522 +	label "bootloader" "$(gettext "Install a bootloader.")" \
   1.523 +	"$(gettext "Usually you should answer yes, unless you want to install a \
   1.524 +bootloader by hand yourself.")"
   1.525 +	error="$?"
   1.526 +	error_msg "$error" "bootloader"
   1.527 +	br
   1.528 +}
   1.529 +
   1.530 +select_winboot()
   1.531 +{
   1.532 +	local winboot="$(/usr/sbin/tazinst get winboot "$INSTFILE")" error
   1.533 +	comment "winboot selection"
   1.534 +	input "checkbox" "winboot" "auto" "$winboot"
   1.535 +	label "winboot" "$(gettext 'Enable Windows Dual-Boot.')" \
   1.536 +	"$(gettext "At start-up, you will be asked whether you want to boot into \
   1.537 +Windows&trade; or SliTaz GNU/Linux.")"
   1.538 +	error="$?"
   1.539 +	error_msg "$error" "winboot"
   1.540 +}
   1.541 +
   1.542 +errors_msg()
   1.543 +{
   1.544 +	if [ "$CHECK" ]; then
   1.545 +		echo "<span class=\"alert\">"
   1.546 +		p "$(gettext "Errors found. Please check your settings.")"
   1.547 +		echo "</span>"
   1.548 +	fi
   1.549 +}
   1.550 +
   1.551 +select_settings()
   1.552 +{
   1.553 +	local settings="$(/usr/sbin/tazinst get settings "$INSTFILE")"
   1.554 +	CHECK=$(GET CHECK)
   1.555 +	errors_msg
   1.556 +	h4 "$(gettext 'Select source media:')"
   1.557 +	open_div_class "box"
   1.558 +	open_div_class "media"
   1.559 +	select_source
   1.560 +	close_div
   1.561 +	close_div
   1.562 +	h4 "$(gettext 'Select destination')"
   1.563 +	open_div_class "box"
   1.564 +	select_root_uuid
   1.565 +	printf "$settings" | grep -q "root_format" \
   1.566 +		&& select_root_format
   1.567 +	close_div
   1.568 +	select_options
   1.569 +	open_div_class "options"
   1.570 +	printf "$settings" | grep -q "home_uuid" && select_home_uuid
   1.571 +	printf "$settings" | grep -q "home_format" \
   1.572 +		&& select_home_format
   1.573 +	printf "$settings" | grep -q "hostname" && select_hostname
   1.574 +	printf "$settings" | grep -q "root_pwd" && select_root_pwd
   1.575 +	printf "$settings" | grep -q "user_login" && select_user_login
   1.576 +	printf "$settings" | grep -q "user_pwd" && select_user_pwd
   1.577 +	close_div
   1.578 +	open_div_class "bootloader"
   1.579 +	printf "$settings" | grep -q "bootloader" && select_bootloader
   1.580 +	printf "$settings" | grep -q "winboot" && select_winboot
   1.581 +	close_div
   1.582 +	br
   1.583 +}
   1.584 +
   1.585 +#--------------
   1.586 +# execute page
   1.587 +#--------------
   1.588 +
   1.589 +save_settings()
   1.590 +{
   1.591 +	h5 "$(gettext "Checking settings...")"
   1.592 +	# install type
   1.593 +	/usr/sbin/tazinst set media "$(GET MEDIA)" "$INSTFILE"
   1.594 +	# source File
   1.595 +	case "$(/usr/sbin/tazinst get media "$INSTFILE")" in
   1.596 +		usb)
   1.597 +			/usr/sbin/tazinst set source "$(GET SRC_USB)" "$INSTFILE" ;;
   1.598 +		iso)
   1.599 +			/usr/sbin/tazinst set source "$(GET SRC_ISO)" "$INSTFILE" ;;
   1.600 +		web)
   1.601 +			/usr/sbin/tazinst set source "$(GET SRC_WEB)" "$INSTFILE" ;;
   1.602 +	esac
   1.603 +	# set defined url
   1.604 +	[ $(GET URL) ] && SRC_WEB=$(GET URL)
   1.605 +	# root Partition
   1.606 +	/usr/sbin/tazinst set root_uuid "$(GET ROOT_UUID)" "$INSTFILE"
   1.607 +	# format root partition
   1.608 +	[ "$(GET ROOT_FORMAT)" ] \
   1.609 +		&& /usr/sbin/tazinst set root_format "$(GET ROOT_FORMAT)" "$INSTFILE" \
   1.610 +		|| /usr/sbin/tazinst unset root_format  "$INSTFILE"
   1.611 +	# home Partition
   1.612 +	if [ "$(GET HOME_UUID)" ] ; then
   1.613 +		/usr/sbin/tazinst set home_uuid "$(GET HOME_UUID)" "$INSTFILE"
   1.614 +		[ "$(GET HOME_FORMAT)" ] \
   1.615 +			&& /usr/sbin/tazinst set home_format "$(GET HOME_FORMAT)" \
   1.616 +				"$INSTFILE" \
   1.617 +			|| /usr/sbin/tazinst unset home_format "$INSTFILE"
   1.618 +	else
   1.619 +		/usr/sbin/tazinst unset home_uuid "$INSTFILE"
   1.620 +		/usr/sbin/tazinst unset home_format "$INSTFILE"
   1.621 +	fi
   1.622 +	# hostname
   1.623 +	/usr/sbin/tazinst set hostname "$(GET HOSTNAME)" "$INSTFILE"
   1.624 +	# root pwd
   1.625 +	/usr/sbin/tazinst set root_pwd "$(GET ROOT_PWD)" "$INSTFILE"
   1.626 +	# user Login
   1.627 +	/usr/sbin/tazinst set user_login "$(GET USER_LOGIN)" "$INSTFILE"
   1.628 +	# user Pwd
   1.629 +	/usr/sbin/tazinst set user_pwd "$(GET USER_PWD)" "$INSTFILE"
   1.630 +	# win Dual-Boot
   1.631 +	/usr/sbin/tazinst set winboot "$(GET WINBOOT)" "$INSTFILE"
   1.632 +	# bootloader
   1.633 +	if [ "$(GET BOOTLOADER)" == "auto" ]; then
   1.634 +		/usr/sbin/tazinst set bootloader "auto" "$INSTFILE"
   1.635 +	else
   1.636 +		/usr/sbin/tazinst unset bootloader "$INSTFILE"
   1.637 +		/usr/sbin/tazinst unset winboot "$INSTFILE"
   1.638 +	fi
   1.639 +	input_hidden "CHECK" "yes"
   1.640 +}
   1.641 +
   1.642 +tazinst_run()
   1.643 +{
   1.644 +	local mode="$(/usr/sbin/tazinst get mode "$INSTFILE")" error
   1.645 +	h4 "Proceeding to: $mode"
   1.646 +	/usr/sbin/tazinst execute "$INSTFILE" | /bin/busybox awk '{
   1.647 +		num=$1+0
   1.648 +		if (num>0 && num<=100){
   1.649 +			print "<script type=\"text/javascript\">"
   1.650 +			printf "document.write(\047<div id=\"progress\">"
   1.651 +			printf "<img src=\"/styles/default/images/loader.gif\" />"
   1.652 +			printf $1 "&#37; " substr($0, length($1)+2, 40)
   1.653 +			print "</div>\047)"
   1.654 +			print "</script>"
   1.655 +			}
   1.656 +		}'
   1.657 +	# end_of_install
   1.658 +	if /usr/sbin/tazinst log | grep -q "x-x-" ; then
   1.659 +		error=1
   1.660 +		echo "<script type=\"text/javascript\">"
   1.661 +		printf "document.write(\047<div id=\"progress\">"
   1.662 +		printf "<img src=\"/styles/default/images/stop.png\" />"
   1.663 +		printf "$(gettext "Errors encountered.")"
   1.664 +		printf "</div>\047)\n"
   1.665 +		echo "</script>"
   1.666 +		br
   1.667 +		br
   1.668 +		/usr/sbin/tazinst log | \
   1.669 +			/bin/busybox awk '$1 == "-x-x-",$1 == "x-x-x"' | sed 's/-x-x-/ /' \
   1.670 +			| grep -v "x-x-x"
   1.671 +	else
   1.672 +		error=0
   1.673 +		echo "<script type=\"text/javascript\">"
   1.674 +		printf "document.write(\047<div id=\"progress\">"
   1.675 +		printf "<img src=\"/styles/default/images/tux.png\" />"
   1.676 +		printf "$(gettext "Process completed!")"
   1.677 +		printf "</div>\047)\n"
   1.678 +		echo "</script>"
   1.679 +		br
   1.680 +		br
   1.681 +		br
   1.682 +		p "$(gettext "Installation is now finished, you can exit the installer
   1.683 +or reboot on your new SliTaz GNU/Linux operating system")."
   1.684 +	fi
   1.685 +	return "$error"
   1.686 +
   1.687 +}
   1.688 +
   1.689 +tazinst_log()
   1.690 +{
   1.691 +	h4 "$(gettext "Tazinst log")"
   1.692 +	printf "<pre>$(/usr/sbin/tazinst log | sed 's/\%/ percent/g')</pre>"
   1.693 +}
   1.694 +
   1.695 +
   1.696 +#-----------------
   1.697 +# page navigation
   1.698 +#-----------------
   1.699 +
   1.700 +display_mode()
   1.701 +{
   1.702 +	local mode="$(/usr/sbin/tazinst get mode "$INSTFILE")"
   1.703 +	case $mode in
   1.704  		install)
   1.705 -			cat << EOT
   1.706 -<div id="wrapper">
   1.707 -<h3>$(gettext 'Install SliTaz')</h3>
   1.708 -
   1.709 -<p>$(gettext "You're going to install SliTaz on a partition of your hard disk \
   1.710 -drive. If you decide to format your HDD, all data will be lost. If you do not \
   1.711 -format, all data except for any existing /home directory will be removed (note the \
   1.712 -home directory contents will be kept as is)."<p>
   1.713 -</div>
   1.714 -<input type="hidden" name="INST_ACTION" value="$1">
   1.715 -EOT
   1.716 +			open_div_id "wrapper"
   1.717 +			h4 "$(gettext 'Install SliTaz')"
   1.718 +			p "$(gettext "You're going to install SliTaz on a partition of your
   1.719 +hard disk drive. If you decide to format your HDD, all data will be
   1.720 +lost. If you do not format, all data except for any existing /home
   1.721 +directory will be removed, the home directory will be kept as is.")"
   1.722 +			close_div
   1.723  			;;
   1.724  		upgrade)
   1.725 -			cat << EOT
   1.726 -<div id="wrapper">
   1.727 -<h2>$(gettext 'Upgrade SliTaz')</h2>
   1.728 -
   1.729 -<p>$(gettext "You're going to upgrade an already installed SliTaz system on \
   1.730 -your hard disk drive. Your /home /etc /var/www directories will be kept, all \
   1.731 -other directories will be removed. Any additional packages added to your old \
   1.732 -Slitaz system will be updated as long you have an active internet connection.")<p>
   1.733 -</div>
   1.734 -<input type="hidden" name="INST_ACTION" value="$1">
   1.735 -EOT
   1.736 +			open_div_id "wrapper"
   1.737 +			h4 "$(gettext 'Upgrade SliTaz')"
   1.738 +			p "$(gettext "You're going to upgrade an already installed SliTaz
   1.739 +system on your hard disk drive. Your /home /etc /var/www directories
   1.740 +will be kept, all other directories will be removed. Any additional
   1.741 +packages added to your old Slitaz system will be updated as long you
   1.742 +have an active internet connection.")"
   1.743 +			close_div
   1.744  			;;
   1.745  	esac
   1.746  }
   1.747  
   1.748 -select_source()
   1.749 +moveto_page()
   1.750  {
   1.751 -	cat <<EOT
   1.752 -<h4 id="source">$(gettext 'Slitaz source media')</h4>
   1.753 -
   1.754 -<div class="box">
   1.755 -<input type="radio" name="INST_TYPE" value="cdrom" $([ "$INST_TYPE" == "cdrom" ] && echo "checked") id="cdrom" />
   1.756 -<label for="cdrom">$(gettext 'LiveCD')</label>
   1.757 -<br />
   1.758 -<input type="radio" name="INST_TYPE" value="usb" $([ "$INST_TYPE" == "usb" ] && echo "checked") id="usb" />
   1.759 -<label for="usb">$(gettext 'LiveUSB:')
   1.760 -<select name="SRC_USB">
   1.761 -EOT
   1.762 -	# List disks if plugged USB device
   1.763 -	usb=0
   1.764 -	if [ -d /proc/scsi/usb-storage ]; then
   1.765 -		for DEV in /sys/block/sd* ; do
   1.766 -			if readlink $DEV | grep -q usb; then
   1.767 -				DEV=$(basename $DEV)
   1.768 -				if [ -d /sys/block/${DEV}/${DEV}1 ]; then
   1.769 -					for i in $(fdisk -l /dev/$DEV | awk '/^\/dev/ {printf "%s ", $1}') ; do
   1.770 -						echo "<option value='$i' $([ "$i" == "$SRC_FILE" ] && echo 'selected') >$i</option>"
   1.771 -						usb=$usb+1
   1.772 -					done
   1.773 -				fi
   1.774 -			fi
   1.775 -		done
   1.776 -	fi
   1.777 -	if [ $usb -lt 1 ]; then
   1.778 -		echo "<option value="">$(gettext 'Not found')</option>"
   1.779 -	fi
   1.780 -	cat << EOT
   1.781 -</select>
   1.782 -</label>
   1.783 -<br />
   1.784 -<input type="radio" name="INST_TYPE" value="iso" $([ "$INST_TYPE" == "iso" ] && echo "checked") id="iso" />
   1.785 -<label for="iso">$(gettext 'ISO file:')</label>
   1.786 -<input type="url" size="50" name="SRC_ISO" $([ "$INST_TYPE" == "iso" ] && echo -e "value=\"$SRC_FILE\"") placeholder="$(gettext 'Full path to the ISO image file')" />
   1.787 -<br />
   1.788 -<input type="radio" name="INST_TYPE" value="web" $([ "$INST_TYPE" == "web" ] && echo "checked") id="web" />
   1.789 -<label for="web">$(gettext 'Web:')
   1.790 -	<a class="button" onclick="document.forms['ConfigForm'].url.value = '$(tazinst showurl stable)'; return true;">$(gettext 'Stable')</a>
   1.791 -	<a class="button" onclick="document.forms['ConfigForm'].url.value = '$(tazinst showurl cooking)'; return true;">$(gettext 'Cooking')</a>
   1.792 -
   1.793 -	$(gettext 'URL:')
   1.794 -	<input id="url" type="url" size="55" name="SRC_WEB" $([ "$INST_TYPE" == "web" ] && echo -e "value=\"$SRC_FILE\"") placeholder="$(gettext 'Full url to an ISO image file')" />
   1.795 -</label>
   1.796 -</div>
   1.797 -EOT
   1.798 +	local back="$1" next="$2" back_msg next_msg
   1.799 +	case "$back" in
   1.800 +		partitioning)
   1.801 +			back_msg=$(gettext 'Back to partitioning') ;;
   1.802 +		input)
   1.803 +			back_msg=$(gettext 'Back to entering settings') ;;
   1.804 +		*)
   1.805 +			back_msg=$(gettext 'Back to Installer Start Page') ;;
   1.806 +	esac
   1.807 +	case "$next" in
   1.808 +		execute|run)
   1.809 +			next_msg=$(gettext 'Proceed to SliTaz installation') ;;
   1.810 +		reboot)
   1.811 +			next_msg=$(gettext 'Installation complete. You can now restart') ;;
   1.812 +		failed)
   1.813 +			next_msg=$(gettext 'Installation failed. See log') ;;
   1.814 +		input)
   1.815 +			next_msg=$(gettext 'Continue installation.') ;;
   1.816 +		*)
   1.817 +			next_msg=$(gettext 'Back to Installer Start Page') ;;
   1.818 +	esac
   1.819 +	hr
   1.820 +	input_hidden "page" "$next"
   1.821 +	a "$back" "$SCRIPT_NAME?page=$back" "$back_msg"
   1.822 +	input "submit" "" "$next_msg"
   1.823  }
   1.824  
   1.825 -select_hdd()
   1.826 +moveto_home()
   1.827  {
   1.828 -cat <<EOT
   1.829 -	<h4 id="hdd">$(gettext 'Hard Disk Drive')</h4>
   1.830 -EOT
   1.831 -}
   1.832 -
   1.833 -select_partition()
   1.834 -{
   1.835 -	cat <<EOT
   1.836 -<div class="box">
   1.837 -<a name="partition"></a>
   1.838 -$(gettext 'Install Slitaz to partition:')
   1.839 -<select name="TGT_PARTITION">
   1.840 -EOT
   1.841 -	# List partitions
   1.842 -	if fdisk -l | grep -q ^/dev/ ; then
   1.843 -		echo "<option value="">$(gettext 'None')</option>"
   1.844 -		for i in $(fdisk -l | awk '/^\/dev/ {printf "%s " $1}'); do
   1.845 -			echo "<option value='$i' $([ "$i" == "$TGT_PARTITION" ] && echo 'selected')>$i</option>"
   1.846 -		done
   1.847 -	else
   1.848 -		echo "<option value="">$(gettext 'Not found')</option>"
   1.849 -	fi
   1.850 -	cat << EOT
   1.851 -</select>
   1.852 -<br />
   1.853 -<input type="checkbox" name="MAIN_FMT" value="yes" $([ -n "$TGT_FS" ] && echo "checked") id="mainfs" />
   1.854 -<label for="mainfs">$(gettext 'Format partition as:')</label>
   1.855 -<select name="MAIN_FS">
   1.856 -EOT
   1.857 -	scan_mkfs
   1.858 -	for i in $FS
   1.859 -	do
   1.860 -		echo "<option value='$i' $([ "$i" == "$TGT_FS" ] && echo 'selected')>$i</option>"
   1.861 -	done
   1.862 -	cat <<EOT
   1.863 -</select>
   1.864 -</div>
   1.865 -EOT
   1.866 -}
   1.867 -
   1.868 -select_old_slitaz()
   1.869 -{
   1.870 -	cat <<EOT
   1.871 -<div class="box">
   1.872 -<a name="partition"></a>
   1.873 -$(gettext 'Existing SliTaz partition to upgrade:')
   1.874 -<select name="TGT_PARTITION">
   1.875 -EOT
   1.876 -	# List partitions
   1.877 -	if fdisk -l | grep -q ^/dev/ ; then
   1.878 -		echo "<option value="">$(gettext 'None')</option>"
   1.879 -		for i in $(blkid | cut -d ":" -f 1); do
   1.880 -			echo "<option value='$i' $([ "$i" == "$TGT_PARTITION" ] && echo 'selected')>$i</option>"
   1.881 -		done
   1.882 -	else
   1.883 -		echo "<option value="">$(gettext 'Not found')</option>"
   1.884 -	fi
   1.885 -	cat <<EOT
   1.886 -</select>
   1.887 -</div>
   1.888 -EOT
   1.889 -}
   1.890 -
   1.891 -select_options()
   1.892 -{
   1.893 -	cat <<EOT
   1.894 -<h4 id="options">$(gettext 'Options')</h4>
   1.895 -EOT
   1.896 -}
   1.897 -
   1.898 -select_home()
   1.899 -{
   1.900 -	cat <<EOT
   1.901 -<div>
   1.902 -<h5 id="home">$(gettext 'home partition')</h5>
   1.903 -
   1.904 -<input type="checkbox" name="HOME_SELECT" value="yes" $([ -n "$TGT_HOME" ] && echo "checked") id="homepart" />
   1.905 -<label for="homepart">$(gettext 'Use a separate partition for /home:')</label>
   1.906 -<select name="TGT_HOME">
   1.907 -EOT
   1.908 -	# List disk if plugged USB device
   1.909 -	if fdisk -l | grep -q ^/dev/ ; then
   1.910 -		echo "<option value="">$(gettext 'None')</option>"
   1.911 -		for i in $(fdisk -l | awk '/^\/dev/ {printf "%s " $1}'); do
   1.912 -			echo "<option value='$i' $([ "$i" == "$TGT_HOME" ] && echo 'selected')>$i</option>"
   1.913 -		done
   1.914 -	else
   1.915 -		echo "<option value="">$(gettext 'Not found')</option>"
   1.916 -	fi
   1.917 -cat <<EOT
   1.918 -</select>
   1.919 -
   1.920 -<input type="checkbox" name="HOME_FMT" value="yes" $([ -n "$TGT_HOME_FS" ] && echo "checked") id="homefs" />
   1.921 -<label for="homefs">$(gettext 'Format partition as:')</label>
   1.922 -<select name="HOME_FS">"
   1.923 -EOT
   1.924 -	for i in $FS
   1.925 -	do
   1.926 -		echo  "<option value='$i' $([ "$i" == "$TGT_HOME_FS" ] && echo 'selected')>$i</option>"
   1.927 -	done
   1.928 -	cat <<EOT
   1.929 -</select>
   1.930 -</div>
   1.931 -EOT
   1.932 -}
   1.933 -
   1.934 -select_hostname()
   1.935 -{
   1.936 -cat << EOT
   1.937 -<div>
   1.938 -	<h5 id="hostname">$(gettext 'Hostname')</h5>
   1.939 -
   1.940 -	$(gettext 'Set Hostname to:')
   1.941 -	<input type="text" id="hst" name="TGT_HOSTNAME" value="$TGT_HOSTNAME" placeholder="$(gettext 'Name of your system')" onkeyup="checkLogin('hst','msgHst'); return false;" />
   1.942 -	<span id="msgHst"></span>
   1.943 -</div>
   1.944 -EOT
   1.945 -}
   1.946 -
   1.947 -select_root()
   1.948 -{
   1.949 -cat << EOT
   1.950 -<div>
   1.951 -	<h5 id="root">$(gettext 'Root')</h5>
   1.952 -
   1.953 -	$(gettext 'Root passwd:')
   1.954 -	<input type="password" id="rootPwd1" name="TGT_ROOT_PWD" value="$TGT_ROOT_PWD" placeholder="$(gettext 'Password of root')" onkeyup="checkPwd('rootPwd1','rootPwd2','msgRootPwd'); return false;" />
   1.955 -
   1.956 -	$(gettext 'Confirm password:')
   1.957 -	<input type="password" id="rootPwd2" value="$TGT_ROOT_PWD" placeholder="$(gettext 'Password of root')" onkeyup="checkPwd('rootPwd1','rootPwd2','msgRootPwd'); return false;" />
   1.958 -
   1.959 -	<span id="msgRootPwd"></span>
   1.960 -</div>
   1.961 -EOT
   1.962 -}
   1.963 -
   1.964 -select_user()
   1.965 -{
   1.966 -cat << EOT
   1.967 -<div>
   1.968 -	<h5 id="user">$(gettext 'User')</h5>
   1.969 -
   1.970 -	$(gettext 'User login:')
   1.971 -	<input type="text" id="usr" name="TGT_USER" value="$TGT_USER" placeholder="$(gettext 'Name of the first user')" onkeyup="checkLogin('usr','msgUsr'); return false;" />
   1.972 -	<span id="msgUsr"></span>
   1.973 -	<br /><br />
   1.974 -
   1.975 -	$(gettext 'User passwd:')
   1.976 -	<input type="password" id="userPwd1" name="TGT_USER_PWD" value="$TGT_USER_PWD" placeholder="$(gettext 'Password of the first user')" onkeyup="checkPwd('userPwd1','userPwd2','msgUserPwd'); return false;" />
   1.977 -
   1.978 -	$(gettext 'Confirm password:')
   1.979 -	<input class="confirm" type="password" id="userPwd2" value="$TGT_USER_PWD" placeholder="$(gettext 'Password of the first user')" onkeyup="checkPwd('userPwd1','userPwd2','msgUserPwd'); return false;" />
   1.980 -	<span id="msgUserPwd"></span>
   1.981 -</div>
   1.982 -EOT
   1.983 -}
   1.984 -
   1.985 -select_grub()
   1.986 -{
   1.987 -cat << EOT
   1.988 -<div>
   1.989 -	<h5 id="grub">$(gettext 'Grub')</h5>
   1.990 -
   1.991 -	<input type="checkbox" name="TGT_GRUB" value="yes" $([ "$TGT_GRUB" == "yes" ] && echo "checked") id="grub" />
   1.992 -	<label for="grub">$(gettext "Install Grub bootloader. Usually you should \
   1.993 -answer yes, unless you want to install grub by hand yourself.")<br /></label>
   1.994 -	<input type="checkbox" name="TGT_WINBOOT" value="auto" $([ -n "$TGT_WINBOOT" ] && echo "checked") id="dualboot" />
   1.995 -	<label for="dualboot">$(gettext 'Enable Windows Dual-Boot.')</label>
   1.996 -</div>
   1.997 -EOT
   1.998 -}
   1.999 -
  1.1000 -moveto_page()
  1.1001 -{
  1.1002 -	case $1 in
  1.1003 -		partitioning)
  1.1004 -			title1="<img src=\"$IMAGES/go-previous.png\" /> $(gettext 'Back to partitioning')" ;;
  1.1005 -		*)
  1.1006 -			page=home
  1.1007 -			title1="<img src=\"$IMAGES/go-first.png\" /> $(gettext 'Back to Installer Start Page')" ;;
  1.1008 -	esac
  1.1009 -	case $2 in
  1.1010 -		write|run)
  1.1011 -			title2="$(gettext 'Proceed to SliTaz installation') <img src=\"$IMAGES/go-next.png\" />" ;;
  1.1012 -		reboot)
  1.1013 -			title2=$(gettext 'Installation complete. You can now restart (reboot)') ;;
  1.1014 -		failed)
  1.1015 -			title2=$(gettext 'Installation failed. See log') ;;
  1.1016 -		*)
  1.1017 -			page=home
  1.1018 -			title2="<img src=\"$IMAGES/go-first.png\" /> $(gettext 'Back to Installer Start Page')" ;;
  1.1019 -	esac
  1.1020 -	cat <<EOT
  1.1021 -<hr />
  1.1022 -<a class="button" value="$1"  href="$SCRIPT_NAME?page=$1" >$title1</a>
  1.1023 -<a class="button" value="$2"  href="$SCRIPT_NAME?page=$2" >$title2</a>
  1.1024 -EOT
  1.1025 +	local msg=$(gettext 'Back to Installer Start Page')
  1.1026 +	a "home" "$SCRIPT_NAME?page=home" "$msg"
  1.1027  }
  1.1028  
  1.1029  page_redirection()
  1.1030  {
  1.1031 -	cat << EOT
  1.1032 +	local page="$1"
  1.1033 +	cat <<EOT
  1.1034  <!DOCTYPE html>
  1.1035  <html>
  1.1036  <head>
  1.1037 @@ -535,128 +566,288 @@
  1.1038  </head>
  1.1039  <body>
  1.1040  <p>$(gettext "If your browser doesn't automatically redirect within a few \
  1.1041 -seconds, you may want to go there manually")</p>
  1.1042 -<p><a href="$SCRIPT_NAME?page=$1">$1</a></p>
  1.1043 +seconds, you may want to go there manually")
  1.1044 +<a href="$SCRIPT_NAME?page=$page">$(gettext "here")</a></p>
  1.1045  </body>
  1.1046  </html>
  1.1047  EOT
  1.1048  }
  1.1049  
  1.1050 +#----------
  1.1051 +# checking
  1.1052 +#----------
  1.1053 +
  1.1054  check_ressources()
  1.1055  {
  1.1056 -	local code
  1.1057 -	code=0
  1.1058 -	# Check tazinst
  1.1059 +	local errorcode=0
  1.1060 +	comment "check_ressources"
  1.1061  	if ! [ -x /usr/sbin/tazinst ] ; then
  1.1062 -		cat <<EOT
  1.1063 -<h3>$(gettext 'Tazinst Error')</h3>
  1.1064 -<p>$(gettext "<strong>tazinst</strong>, the lightweight SliTaz HDD installer \
  1.1065 -is missing. Any installation cannot be done without tazinst.")</p>
  1.1066 -
  1.1067 -<p>$(gettext "Check tazinst' permissions, or reinstall the slitaz-tools \
  1.1068 -package:")</p>
  1.1069 -<code># tazpkg get-install slitaz-tools --forced</code>
  1.1070 -EOT
  1.1071 -		code=1
  1.1072 +		h4 "$(gettext 'Tazinst Error')"
  1.1073 +		p "$(gettext "<strong>tazinst</strong>, the backend to slitaz-installer
  1.1074 +is missing. Any installation can not be done without tazinst.")"
  1.1075 +		p "$(gettext "Check tazinst permissions, or reinstall the
  1.1076 +slitaz-installer package.")"
  1.1077 +		errorcode=1
  1.1078  	else
  1.1079 -		# Check tazinst required version
  1.1080 -		v=$(tazinst version | tr -d '[:alpha:]')
  1.1081 -		r=$TAZINST_REQUIRED_VERSION
  1.1082 -		if ! (echo "$v" | awk -v r=$r '{v=$v+0}{ if (v < r) exit 1}') ; then
  1.1083 -			cat <<EOT
  1.1084 -<h3>$(gettext 'Tazinst Error')</h3>
  1.1085 -
  1.1086 -<p>$(eval_gettext "<strong>tazinst</strong> ($v) is not at the required \
  1.1087 -version ($r), use tazinst in a xterm or reinstall the slitaz-tools package:")</p>
  1.1088 -<code># tazpkg get-install slitaz-tools --forced</code>
  1.1089 -EOT
  1.1090 -			code=1
  1.1091 +		# check tazinst minimum version
  1.1092 +		v=$(/usr/sbin/tazinst version | tr -d '[:alpha:]')
  1.1093 +		r=$TAZINST_MINIMUM_VERSION
  1.1094 +		if ! (echo "$v" | /bin/busybox awk -v r=$r \
  1.1095 +				'{v=$v+0}{ if (v < r) exit 1}') ; then
  1.1096 +			h4 "$(gettext 'Tazinst Error')"
  1.1097 +			p "$(gettext "<strong>tazinst</strong>, the slitaz-installer
  1.1098 +backend, is not at the minimum required version. Any installation
  1.1099 +cannot be done without tazinst.")"
  1.1100 +			p "$(gettext "Reinstall the slitaz-installer package, or use
  1.1101 +tazinst in cli mode.")"
  1.1102 +			errorcode=1
  1.1103 +		fi
  1.1104 +		# check tazinst maximum version
  1.1105 +		v=$(/usr/sbin/tazinst version | tr -d '[:alpha:]')
  1.1106 +		r=$TAZINST_MAXIMUM_VERSION
  1.1107 +		if ! (echo "$v" | /bin/busybox awk -v r=$r \
  1.1108 +				'{v=$v+0}{ if (v > r) exit 1}') ; then
  1.1109 +			h4 "$(gettext 'Tazinst Error')"
  1.1110 +			p "$(gettext "<strong>tazinst</strong>, the slitaz-installer
  1.1111 +backend, is at a higher version than the maximum authorized
  1.1112 +by the slitaz-installer. Any installation cannot be done.")"
  1.1113 +			p "$(gettext "Reinstall the slitaz-installer package, or use
  1.1114 +tazinst in cli mode.")"
  1.1115 +			errorcode=1
  1.1116  		fi
  1.1117  	fi
  1.1118 -	return $code
  1.1119 +	return $errorcode
  1.1120  }
  1.1121  
  1.1122 -run_tazinst()
  1.1123 +
  1.1124 +#---------------
  1.1125 +# html snippets
  1.1126 +#---------------
  1.1127 +
  1.1128 +br()
  1.1129  {
  1.1130 -	cat << EOT
  1.1131 -<h4>$(gettext 'Proceeding: ()')</h4>
  1.1132 -<p>$(gettext 'Please wait until processing is complete')</p>
  1.1133 -EOT
  1.1134 -	table_start
  1.1135 -	tazinst $(GET INST_ACTION) $INSTFILE | \
  1.1136 -		awk '{print "<tr><td><tt>" $0 "</tt></td></tr>"}'
  1.1137 -	table_end
  1.1138 -	echo "<p>$(gettext 'Completed.')</p>"
  1.1139 -	return $(grep -c "cancelled on error" $INSTFILE)
  1.1140 +	echo "<br />"
  1.1141  }
  1.1142  
  1.1143 -tazinst_log()
  1.1144 +hr()
  1.1145  {
  1.1146 -	echo "<pre>$(tazinst log)</pre>"
  1.1147 +	echo "<hr />"
  1.1148  }
  1.1149  
  1.1150 -scan_mkfs()
  1.1151 +comment()
  1.1152  {
  1.1153 -	for path in /bin /sbin /usr/bin /usr/sbin
  1.1154 -	do
  1.1155 -		[ -e $path/mkfs.btrfs ] && FS=btrfs
  1.1156 -		[ -e $path/mkfs.cramfs ] && FS="$FS cramfs"
  1.1157 -		[ -e $path/mkfs.ext2 ] && FS="$FS ext2"
  1.1158 -		[ -e $path/mkfs.ext3 ] && FS="$FS ext3"
  1.1159 -		[ -e $path/mkfs.ext4 ] && FS="$FS ext4"
  1.1160 -		[ -e $path/mkfs.jfs ] && FS="$FS jfs"
  1.1161 -		[ -e $path/mkfs.minix ] && FS="$FS minix"
  1.1162 -		[ -e $path/mkfs.reiserfs ] && FS="$FS reiserfs"
  1.1163 -		[ -e $path/mkfs.xfs ] && FS="$FS xfs"
  1.1164 -	done
  1.1165 +	echo "<!-- $1 -->"
  1.1166 +}
  1.1167 +
  1.1168 +a()
  1.1169 +{
  1.1170 +	local value="$1" href="$2" msg="$3"
  1.1171 +	echo "<a class=\"button\" value=\"$value\" href=\"$href\">$msg</a>"
  1.1172 +}
  1.1173 +
  1.1174 +open_div()
  1.1175 +{
  1.1176 +	echo "<div>"
  1.1177 +}
  1.1178 +
  1.1179 +open_div_id()
  1.1180 +{
  1.1181 +	echo "<div id=\"$1\">"
  1.1182 +}
  1.1183 +
  1.1184 +open_div_class()
  1.1185 +{
  1.1186 +	echo "<div class=\"$1\">"
  1.1187 +}
  1.1188 +
  1.1189 +close_div()
  1.1190 +{
  1.1191 +	echo "</div>"
  1.1192 +}
  1.1193 +
  1.1194 +p()
  1.1195 +{
  1.1196 +	echo "<p>$1</p>"
  1.1197 +}
  1.1198 +
  1.1199 +h4()
  1.1200 +{
  1.1201 +	echo "<h4>$1</h4>"
  1.1202 +}
  1.1203 +
  1.1204 +h5()
  1.1205 +{
  1.1206 +	echo "<h5>$1</h5>"
  1.1207 +}
  1.1208 +
  1.1209 +label()
  1.1210 +{
  1.1211 +	local setting="$1" label="$2" title="$3" name="$4" error=0
  1.1212 +	[ -z "$name" ] && name="$setting"
  1.1213 +	printf "<label for=\"$name\""
  1.1214 +	[ "$title" ] && echo " title=\"$title\">" || echo ">"
  1.1215 +	# display label in red in case of error
  1.1216 +	if [ "$CHECK" ]; then
  1.1217 +		/usr/sbin/tazinst check "$setting" "$INSTFILE"
  1.1218 +		error="$?"
  1.1219 +		[ "$error" -gt "0" ] && [ "$error" -lt "127" ] && \
  1.1220 +			printf "<span class=\"alert\">"
  1.1221 +		printf "$label"
  1.1222 +		[ "$error" -gt "0" ] && [ "$error" -lt "127" ] && \
  1.1223 +			printf "<sup>*</sup></span>"
  1.1224 +	else
  1.1225 +		printf "$label"
  1.1226 +	fi
  1.1227 +	echo "</label>"
  1.1228 +	return "$error"
  1.1229 +}
  1.1230 +
  1.1231 +label_media()
  1.1232 +{
  1.1233 +	local id="$1" label="$2" media="$3" title="$4" retcode=0
  1.1234 +	if [ "$media" == "$id" ]; then
  1.1235 +		label "source" "$label" "$title" "$media"
  1.1236 +		retcode="$?"
  1.1237 +	else
  1.1238 +		printf "<label for=\"$id\""
  1.1239 +		[ "$title" ] && echo " title=\"$title\">" || echo ">"
  1.1240 +		echo "$label</label>"
  1.1241 +	fi
  1.1242 +	return "$retcode"
  1.1243 +}
  1.1244 +
  1.1245 +error_msg()
  1.1246 +{
  1.1247 +	local error="$1" setting="$2" line="$3"
  1.1248 +	if [ "$CHECK" ]; then
  1.1249 +		if [ "$error" -gt "0" ]; then
  1.1250 +			[ "$error" -lt "128" ] && printf "<span class=\"alert\">" \
  1.1251 +				|| printf "<span class=\"warning\">"
  1.1252 +			if [ "$line" ]; then
  1.1253 +				/usr/sbin/tazinst check "$setting" "$INSTFILE" 2>&1 | \
  1.1254 +					/bin/busybox awk -v LINE="$line" '{if (NR==LINE){print}}'
  1.1255 +			else
  1.1256 +				/usr/sbin/tazinst check "$setting" "$INSTFILE" 2>&1
  1.1257 +			fi
  1.1258 +			echo "</span>"
  1.1259 +		fi
  1.1260 +	fi
  1.1261 +}
  1.1262 +
  1.1263 +select()
  1.1264 +{
  1.1265 +	local list="$1" selected="$2" name="$3" type="$4" none="$(gettext "None")"
  1.1266 +	printf "$list" | /bin/busybox awk -v SELECTED="$selected" -v NONE="$none" \
  1.1267 +			-v NAME="$name" -v TYPE="$type" 'BEGIN{
  1.1268 +		TYPE=TYPE+0
  1.1269 +		print "<select name=\"" NAME "\">"
  1.1270 +		print "<option value=>< " NONE " ></option>"
  1.1271 +	}
  1.1272 +	{
  1.1273 +		printf "<option value=\"" $1 "\""
  1.1274 +		if ($1 == SELECTED) printf " selected"
  1.1275 +		if (TYPE == 0)
  1.1276 +			print ">" $0 "</option>"
  1.1277 +		if (TYPE == 1)
  1.1278 +			print ">" substr($0,12) "</option>"
  1.1279 +		if (TYPE == 2)
  1.1280 +			print ">" $2 "</option>"
  1.1281 +	}
  1.1282 +	END{
  1.1283 +		print "</select>"
  1.1284 +	}'
  1.1285 +}
  1.1286 +
  1.1287 +input()
  1.1288 +{
  1.1289 +	local type="$1" name="$2" value="$3" selected="$4" help="$5" action="$6"
  1.1290 +	printf "<input type=\"$type\" id=\"$name\" list=\"list_$name\" "
  1.1291 +	printf "name=\"$(printf $name | tr [a-z] [A-Z])\" class=\"$type\" "
  1.1292 +	[ "$value" ] && printf "value=\"$value\" "
  1.1293 +	[ "$value" == "$selected" ] && printf "checked "
  1.1294 +	[ "$action" ] && printf \
  1.1295 +		"onInput=\"document.getElementById('$action').checked = true;\" "
  1.1296 +	[ "$help" ] && echo "placeholder=\"$help\" />" || echo "/>"
  1.1297 +}
  1.1298 +
  1.1299 +input_media()
  1.1300 +{
  1.1301 +	local id="$1" media="$2"
  1.1302 +	echo -n "<input type=\"radio\" name=\"MEDIA\" value=\"$id\" id=\"$id\" "
  1.1303 +	echo "$([ "$media" == "$id" ] && echo "checked") />"
  1.1304 +}
  1.1305 +
  1.1306 +input_hidden()
  1.1307 +{
  1.1308 +	local name="$1" value="$2"
  1.1309 +	echo "<input type=\"hidden\" name=\"$name\" value=\"$value\" />"
  1.1310 +}
  1.1311 +
  1.1312 +datalist()
  1.1313 +{
  1.1314 +	local list="$1" name="$2" none="$(gettext "None")"
  1.1315 +	echo "<datalist id=\"list_$name\">"
  1.1316 +	# workaround for browsers  that don’t support the datalist element..
  1.1317 +	echo "<select class=\"workaround\" id=\"sel_$name\" \
  1.1318 +onChange='displaySelValue(\"sel_$name\",\"$name\")' \
  1.1319 +onBlur='displaySelValue(\"sel_$name\",\"$name\")'>"
  1.1320 +	# workaround ..end
  1.1321 +	printf "$list" | /bin/busybox awk -v NONE="$none" 'BEGIN{
  1.1322 +		line=0
  1.1323 +	}
  1.1324 +	{
  1.1325 +		TEXT=$1
  1.1326 +		sub(".*/","",TEXT)
  1.1327 +		print "<option value=\"" $1 "\">" TEXT "</option>"
  1.1328 +		line++
  1.1329 +	}
  1.1330 +	END{
  1.1331 +		if (line < 1)
  1.1332 +			print "<option value=>< " NONE " ></option>"
  1.1333 +	}'
  1.1334 +	echo "</select>"
  1.1335 +	echo "</datalist>"
  1.1336 +}
  1.1337 +
  1.1338 +format()
  1.1339 +{
  1.1340 +	list_fs="$1" selected="$2" name="$3" none="$(gettext "Do not format")"
  1.1341 +	printf "<label for=\"$name\" title=\"$(gettext "To format this partition, \
  1.1342 +select a filesystem, usually it's safe to use ext4")\">"
  1.1343 +	echo "$(gettext "Formatting option:")</label>"
  1.1344 +	printf "$list_fs" | /bin/busybox awk -v SELECTED=$selected -v NONE="$none" \
  1.1345 +			-v NAME="$name" 'BEGIN{
  1.1346 +		RS=" "
  1.1347 +		print "<select name=\"" NAME "\">"
  1.1348 +		print "<option value=\"\">" NONE "</option>"
  1.1349 +		line=0
  1.1350 +	}
  1.1351 +	{
  1.1352 +		printf "<option value=\"" $1 "\""
  1.1353 +		if ($1 == SELECTED) printf " selected"
  1.1354 +		print ">" $0 "</option>"
  1.1355 +		line++
  1.1356 +	}
  1.1357 +	END{
  1.1358 +		if (line < 1)
  1.1359 +			print "<option value=>< " NONE " ></option>"
  1.1360 +		print "</select>"
  1.1361 +	}'
  1.1362 +}
  1.1363 +
  1.1364 +button()
  1.1365 +{
  1.1366 +	local action="$1" msg="$2" title="$3"
  1.1367 +	echo "<a class=\"button\" href=\"$SCRIPT_NAME?page=$action\" \
  1.1368 +title=\"$title\">$msg</a>"
  1.1369  }
  1.1370  
  1.1371  form_start()
  1.1372  {
  1.1373 +	local name="$1"
  1.1374  	cat <<EOT
  1.1375 -<script src="lib/user.js"></script>
  1.1376 -<script type="text/javascript">
  1.1377 -	function Validate(page) {
  1.1378 -		if (page == "install") {
  1.1379 -			// hostname
  1.1380 -			if (false == checkLogin('hst','msgHst')) {
  1.1381 -				alert("$(gettext 'Hostname error')");
  1.1382 -				return false;
  1.1383 -			// root pwd
  1.1384 -			} else if (false == checkPwd('rootPwd1','rootPwd2','msgRootPwd')) {
  1.1385 -				alert("$(gettext 'Root password error')");
  1.1386 -				return false;
  1.1387 -			// user
  1.1388 -			} else if (false == checkLogin('usr','msgUsr')) {
  1.1389 -				alert("$(gettext 'User login error')");
  1.1390 -				return false;
  1.1391 -			// user pwd
  1.1392 -			} else if (false == checkPwd('userPwd1','userPwd2','msgUserPwd')) {
  1.1393 -				alert("$(gettext 'User password error')");
  1.1394 -				return false;
  1.1395 -			} else {
  1.1396 -				var r=confirm("$(gettext 'Do you really want to continue?')");
  1.1397 -				if (r==true)
  1.1398 -				{
  1.1399 -					document.ConfigForm.submit();
  1.1400 -				} else {
  1.1401 -					return false;
  1.1402 -				}
  1.1403 -			}
  1.1404 -		} else if (page == "write") {
  1.1405 -			return true;
  1.1406 -		} else {
  1.1407 -			var r=confirm("$(gettext 'Do you really want to continue?')");
  1.1408 -			if (r==true)
  1.1409 -			{
  1.1410 -				document.ConfigForm.submit();
  1.1411 -			} else {
  1.1412 -				return false;
  1.1413 -			}
  1.1414 -		}
  1.1415 -	}
  1.1416 -</script>
  1.1417 -<form name="ConfigForm" method="get" onsubmit="return Validate('$1')" action="$SCRIPT_NAME">
  1.1418 +<form name="Form_$name" method="get" onsubmit="return true" \
  1.1419 +action="$SCRIPT_NAME">
  1.1420  EOT
  1.1421  }
  1.1422  
  1.1423 @@ -665,10 +856,117 @@
  1.1424  	echo "</form>"
  1.1425  }
  1.1426  
  1.1427 +xhtml_header()
  1.1428 +{
  1.1429 +	cat << EOT
  1.1430 +<!DOCTYPE html>
  1.1431 +<html xmlns="http://www.w3.org/1999/xhtml" lang="$(echo $LANG | cut -f1 -d_)">
  1.1432 +<head>
  1.1433 +	<title>$(gettext "SliTaz Installer")</title>
  1.1434 +	<meta charset="utf-8" />
  1.1435 +	<link rel="shortcut icon" href="/styles/$STYLE/favicon.ico" />
  1.1436 +	<style type="text/css">
  1.1437 +		.box label {
  1.1438 +			display:inline-block;
  1.1439 +			vertical-align:middle;
  1.1440 +		    width: 130px;
  1.1441 +		}
  1.1442 +		.media label {
  1.1443 +			display:inline-block;
  1.1444 +			vertical-align:middle;
  1.1445 +		    width: 110px;
  1.1446 +		}
  1.1447 +		.options label {
  1.1448 +			display:inline-block;
  1.1449 +			vertical-align:middle;
  1.1450 +		    width: 140px;
  1.1451 +		}
  1.1452 +		.box .text {
  1.1453 +			width: 350px;
  1.1454 +		}
  1.1455 +		input {margin-bottom:3px;}
  1.1456 +		span.alert {color: red}
  1.1457 +		span.warning { color: darkgray}
  1.1458 +		#progress {
  1.1459 +			background-color: #f8f8f8;
  1.1460 +			border: 1px solid #ddd;
  1.1461 +			color: #666;
  1.1462 +			cursor: progress;
  1.1463 +			position: absolute;
  1.1464 +			width: 348px;
  1.1465 +			padding: 4px 4px 2px;
  1.1466 +		}
  1.1467 +	</style>
  1.1468 +	<link rel="stylesheet" type="text/css" href="/styles/$STYLE/style.css" />
  1.1469 +	<!-- Function to hide the loading message when page is generated. -->
  1.1470 +	<script type="text/javascript">
  1.1471 +		function showProgress(){
  1.1472 +			document.getElementById("progress").style.display='none';
  1.1473 +		}
  1.1474 +	</script>
  1.1475 +	<!-- workaround for browsers  that don’t support the datalist element -->
  1.1476 +	<style type="text/css">
  1.1477 +		.workaround {width: 110px;}
  1.1478 +	</style>
  1.1479 +	<script>
  1.1480 +		function displaySelValue(selectId,inputId)
  1.1481 +		{
  1.1482 +			var slct = document.getElementById(selectId);
  1.1483 +			var input = document.getElementById(inputId);
  1.1484 +			document.getElementById("src_iso").value="";
  1.1485 +			document.getElementById("src_web").value="";
  1.1486 +			if (inputId =="src_iso"){
  1.1487 +				document.getElementById("iso").checked = true;
  1.1488 +			}
  1.1489 +			if (inputId =="src_web"){
  1.1490 +				document.getElementById("web").checked = true;
  1.1491 +			}
  1.1492 +			input.value = slct.options[slct.selectedIndex].value;
  1.1493 +
  1.1494 +		}
  1.1495 +	</script>
  1.1496 +	<!-- workaround end -->
  1.1497 +</head>
  1.1498 +<body onload="showProgress()">
  1.1499 +</head>
  1.1500 +<body>
  1.1501 +
  1.1502 +<!--
  1.1503 +<div id="header">
  1.1504 +	<h1>$(gettext "SliTaz Installer")</h1>
  1.1505 +</div>
  1.1506 +-->
  1.1507 +
  1.1508 +<!-- Page content -->
  1.1509 +<div id="content">
  1.1510 +EOT
  1.1511 +}
  1.1512 +
  1.1513 +xhtml_footer()
  1.1514 +{
  1.1515 +	cat << EOT
  1.1516 +<!-- End of content-->
  1.1517 +</div>
  1.1518 +
  1.1519 +<div id="footer">
  1.1520 +	$(gettext 'Copyright') &copy; 2012-2013
  1.1521 +	<a href="http://www.slitaz.org/">SliTaz GNU/Linux</a>
  1.1522 +	- <a href="/index.cgi?file=/usr/share/licenses/bsd.txt">
  1.1523 +	$(gettext 'BSD License')</a>
  1.1524 +</div>
  1.1525 +
  1.1526 +</body>
  1.1527 +</html>
  1.1528 +EOT
  1.1529 +}
  1.1530 +
  1.1531 +
  1.1532  #
  1.1533 -# Main
  1.1534 +# main
  1.1535  #
  1.1536  
  1.1537 +header
  1.1538 +
  1.1539  case "$(GET page)" in
  1.1540  	home)
  1.1541  		xhtml_header
  1.1542 @@ -676,84 +974,64 @@
  1.1543  		select_install
  1.1544  		select_upgrade
  1.1545  		;;
  1.1546 +	install)
  1.1547 +		xhtml_header
  1.1548 +		/usr/sbin/tazinst set mode install "$INSTFILE"
  1.1549 +		page_redirection partitioning
  1.1550 +		;;
  1.1551  	partitioning)
  1.1552  		xhtml_header
  1.1553 -		display_action install
  1.1554 +		form_start
  1.1555 +		display_mode
  1.1556  		select_gparted
  1.1557 +		moveto_page home input
  1.1558 +		form_end
  1.1559  		;;
  1.1560  	gparted)
  1.1561 -		su - -c "exec env DISPLAY=':0.0' XAUTHORITY='/var/run/slim.auth' /usr/sbin/gparted"
  1.1562 - 		xhtml_header
  1.1563 +		exec_gparted
  1.1564 +		xhtml_header
  1.1565  		page_redirection partitioning
  1.1566  		;;
  1.1567 -	install)
  1.1568 -		xhtml_header
  1.1569 -		form_start install
  1.1570 -		display_action install
  1.1571 -		read_setup
  1.1572 -		select_source
  1.1573 -		select_hdd
  1.1574 -		select_partition
  1.1575 -		select_options
  1.1576 -		select_home
  1.1577 -		select_hostname
  1.1578 -		select_root
  1.1579 -		select_user
  1.1580 -		select_grub
  1.1581 -		moveto_page partitioning write
  1.1582 -		form_end
  1.1583 -		;;
  1.1584  	upgrade)
  1.1585  		xhtml_header
  1.1586 -		form_start upgrade
  1.1587 -		display_action upgrade
  1.1588 -		read_setup
  1.1589 -		select_source
  1.1590 -		select_hdd
  1.1591 -		select_old_slitaz
  1.1592 -		select_options
  1.1593 -		select_grub
  1.1594 -		moveto_page home write
  1.1595 +		/usr/sbin/tazinst set mode upgrade "$INSTFILE"
  1.1596 +		page_redirection input
  1.1597 +		;;
  1.1598 +	input)
  1.1599 +		xhtml_header
  1.1600 +		form_start
  1.1601 +		display_mode
  1.1602 +		select_settings
  1.1603 +		moveto_page partitioning execute
  1.1604  		form_end
  1.1605  		;;
  1.1606 -	write)
  1.1607 -		write_setup
  1.1608 +	execute)
  1.1609  		xhtml_header
  1.1610 -		if ! (tazinst check $INSTFILE); then
  1.1611 -			page_redirection $(GET INST_ACTION)
  1.1612 +		form_start
  1.1613 +		display_mode
  1.1614 +		save_settings
  1.1615 +		if ! (/usr/sbin/tazinst check all $INSTFILE > /dev/null); then
  1.1616 +			page_redirection "input&CHECK=yes"
  1.1617  		else
  1.1618 -			read_setup
  1.1619 -			form_start write
  1.1620 -			display_action $(GET INST_ACTION)
  1.1621 -			if run_tazinst; then
  1.1622 -				moveto_page home reboot
  1.1623 -			else
  1.1624 -				moveto_page home failed
  1.1625 -			fi
  1.1626 -			form_end
  1.1627 +			tazinst_run && moveto_page home reboot \
  1.1628 +						|| moveto_page input failed
  1.1629  		fi
  1.1630 +		form_end
  1.1631  		;;
  1.1632  	reboot)
  1.1633 +		/usr/sbin/tazinst clean "$INSTFILE"
  1.1634  		reboot ;;
  1.1635  	failed)
  1.1636  		xhtml_header
  1.1637 -		display_log
  1.1638 -		;;
  1.1639 -	menu_install)
  1.1640 -		xhtml_header
  1.1641 -		if check_ressources; then
  1.1642 -			page_redirection partitioning
  1.1643 -		fi
  1.1644 -		;;
  1.1645 -	menu_upgrade)
  1.1646 -		xhtml_header
  1.1647 -		if check_ressources; then
  1.1648 -			page_redirection upgrade
  1.1649 -		fi
  1.1650 +		form_start
  1.1651 +		tazinst_log
  1.1652 +		moveto_home
  1.1653 +		form_end
  1.1654  		;;
  1.1655  	*)
  1.1656  		xhtml_header
  1.1657  		if check_ressources; then
  1.1658 +			/usr/sbin/tazinst new "$INSTFILE"
  1.1659  			page_redirection home
  1.1660  		fi
  1.1661  		;;