tazpanel diff installer.cgi @ rev 288

live: make live usb into tazpanle, new input and button style
author Christophe Lincoln <pankso@slitaz.org>
date Mon Apr 02 11:22:06 2012 +0200 (2012-04-02)
parents 0f7b1e7068c5
children 72e9955ebdff
line diff
     1.1 --- a/installer.cgi	Mon Mar 12 16:51:20 2012 +0000
     1.2 +++ b/installer.cgi	Mon Apr 02 11:22:06 2012 +0200
     1.3 @@ -7,7 +7,7 @@
     1.4  # Authors : Dominique Corbex <domcox@slitaz.org>
     1.5  #
     1.6  
     1.7 -VERSION=0.28
     1.8 +VERSION=0.29
     1.9  
    1.10  # Common functions from libtazpanel
    1.11  . lib/libtazpanel
    1.12 @@ -139,28 +139,15 @@
    1.13  	cat <<EOT
    1.14  <div id="wrapper">
    1.15  	<h2>$(gettext "SliTaz Installer")</h2>
    1.16 -	<p>$(gettext "The SliTaz Installer installs or upgrades SliTaz to a hard disk 
    1.17 -		drive from a device like a Live-CD or LiveUSB key, from a SliTaz ISO file, or 
    1.18 -		from the web by downloading an ISO file.")<p>
    1.19 +<p>
    1.20 +	$(gettext "The SliTaz Installer installs or upgrades SliTaz to a hard disk
    1.21 +	drive from a device like a Live-CD or LiveUSB key, from a SliTaz ISO file,
    1.22 +	or from the web by downloading an ISO file.")
    1.23 +<p>
    1.24  </div>
    1.25  EOT
    1.26  }
    1.27  
    1.28 -select_gparted()
    1.29 -{
    1.30 -	cat <<EOT
    1.31 -<div class="box">
    1.32 -	<h4>$(gettext "About")</h4>
    1.33 -<p>
    1.34 -	$(gettext "Before installation, you may need to resize partitions
    1.35 -	on your hard disk drive in order to make space for SliTaz GNU/Linux.
    1.36 -	You can graphically manage your partitions with Gparted")
    1.37 -</p>
    1.38 -</div>
    1.39 -<a class="button" href="$SCRIPT_NAME?page=gparted">$(gettext "Execute Gparted")</a>
    1.40 -EOT
    1.41 -}
    1.42 -
    1.43  select_install()
    1.44  {
    1.45  	cat <<EOT
    1.46 @@ -168,13 +155,18 @@
    1.47  	<h4>$(gettext "Install")</h4>
    1.48  <p>
    1.49  	$(gettext "Install SliTaz on a partition of your hard disk drive. If
    1.50 -	you decide to format your HDD, all data will be lost. If you do not 
    1.51 +	you decide to format your partition, all data will be lost. If you do not
    1.52  	format, all data except for any existing /home directory will be removed, 
    1.53  	the home directory will be kept as is.")
    1.54  </p>
    1.55 +<p>
    1.56 +	$(gettext "Before installation, you may need to create or resize partitions
    1.57 +	on your hard disk drive in order to make space for SliTaz GNU/Linux.
    1.58 +	You can graphically manage your partitions with Gparted")
    1.59 +</p>
    1.60  </div>
    1.61  <p>
    1.62 -<a class="button" href="$SCRIPT_NAME?page=install">$(gettext "Install SliTaz")</a>
    1.63 +<a class="button" href="$SCRIPT_NAME?page=partitioning">$(gettext "Install SliTaz")</a>
    1.64  EOT
    1.65  }
    1.66  
    1.67 @@ -196,6 +188,58 @@
    1.68  EOT
    1.69  }
    1.70  
    1.71 +select_gparted()
    1.72 +{
    1.73 +	cat <<EOT
    1.74 +<h4>$(gettext "Partitioning")</h4>
    1.75 +<div class="box">
    1.76 +<p>
    1.77 +	$(gettext "On most used systems, the hard drive is already dedicated to 
    1.78 +	partitions for Windows<sup>&copy;</sup>, or Linux, or another operating 
    1.79 +	system. You'll need to resize these partitions in order to make space for
    1.80 +	SliTaz GNU/Linux. SliTaz will co-exist with other operating systems already
    1.81 +	installed on your hard drive.") 
    1.82 +</p>
    1.83 +<p>
    1.84 +	$(gettext "The amount of space needed depends on how much software you 
    1.85 +	plan to install	and how much space you require for users. It's conceivable
    1.86 +	that you could run a minimal SliTaz system in 300 megs or less, but 2 gigs
    1.87 +	is indeed more comfy.")
    1.88 +<p>
    1.89 +	$(gettext "A separate home partition, and a partition that will be used 
    1.90 +	as Linux swap space may be created if needed. Slitaz detects and uses swap
    1.91 +	partitions automatically.")
    1.92 +</p>
    1.93 +</p>
    1.94 +</div>
    1.95 +<div class="box">
    1.96 +<p>
    1.97 +	$(gettext "You can graphically manage your partitions with Gparted. GParted
    1.98 +	is a partition editor for graphically managing your disk partitions. Gparted
    1.99 +	allows you to create, destroy, resize and copy partitions without data
   1.100 +	loss.")
   1.101 +</p>
   1.102 +<p>
   1.103 +	$(gettext "Gparted supports ext2, ext3, ext4, linux swap, ntfs and fat32
   1.104 +	filesystems right out of the box. Support for xjs, jfs, hfs and other
   1.105 +	filesystems is available as well but you first need to add drivers for 
   1.106 +	these filesystems by installing the related packages xfsprogs, jfsutils,
   1.107 +	linux-hfs and so on.")
   1.108 +</p>
   1.109 +</div>
   1.110 +<a class="button" href="$SCRIPT_NAME?page=gparted">$(gettext "Execute Gparted")</a>
   1.111 +<h5>$(gettext "Continue installation")</h5>
   1.112 +	$(gettext "Once you've made room for SliTaz on your drive,	you
   1.113 +	should be able to continue installation.")
   1.114 +
   1.115 +<hr />
   1.116 +<a class="button" value="$1" href="$SCRIPT_NAME?page=home" >
   1.117 +	$(gettext "Back to Installer Start Page")</a>
   1.118 +<a class="button" value="$2" href="$SCRIPT_NAME?page=install">
   1.119 +	$(gettext "Continue Installation")</a>
   1.120 +EOT
   1.121 +}
   1.122 +
   1.123  display_action()
   1.124  {
   1.125  	case $1 in
   1.126 @@ -230,7 +274,7 @@
   1.127  {
   1.128  	cat <<EOT
   1.129  <a name="source"></a>
   1.130 -<h4>$(gettext "Source")</h4>
   1.131 +<h4>$(gettext "Slitaz source media")</h4>
   1.132  <div class="box">
   1.133  <input type="radio" name="INST_TYPE" value="cdrom" $([ "$INST_TYPE" == "cdrom" ] && echo "checked") id="cdrom" />
   1.134  <label for="cdrom">$(gettext "LiveCD")</td></label>
   1.135 @@ -276,14 +320,20 @@
   1.136  EOT
   1.137  }
   1.138  
   1.139 +select_hdd()
   1.140 +{
   1.141 +cat <<EOT
   1.142 +	<a name="hdd"></a>
   1.143 +	<h4></span>$(gettext "Hard Disk Drive")</h4>
   1.144 +EOT
   1.145 +}
   1.146 +
   1.147  select_partition()
   1.148  {
   1.149 -	has_partitions=1
   1.150  	cat <<EOT
   1.151 +<div class="box">
   1.152  <a name="partition"></a>
   1.153 -<h4></span>$(gettext "Main Partition")</h4>
   1.154 -<div class="box">
   1.155 -$(gettext "Partition to use:")
   1.156 +$(gettext "Install Slitaz to partition:")
   1.157  <select name="TGT_PARTITION">
   1.158  EOT
   1.159  	# List partitions
   1.160 @@ -293,15 +343,10 @@
   1.161  			echo "<option value='$i' $([ "$i" == "$TGT_PARTITION" ] && echo "selected")>$i</option>"
   1.162  		done
   1.163  	else
   1.164 -		has_partitions=0
   1.165  		echo "<option value="">$(gettext "Not found")</option>"
   1.166  	fi
   1.167 -	echo "</select>"
   1.168 -
   1.169 -	if [ has_partitions == 0 ]; then
   1.170 -		echo "<a class="button" href="$SCRIPT_NAME?page=gparted">$(gettext "Gparted")</a>"
   1.171 -	fi
   1.172  	cat << EOT
   1.173 +</select>
   1.174  <br />
   1.175  <input type="checkbox" name="MAIN_FMT" value="yes" $([ -n "$TGT_FS" ] && echo "checked") id="mainfs" />
   1.176  <label for="mainfs">$(gettext "Format partition as"):</label>
   1.177 @@ -321,10 +366,9 @@
   1.178  select_old_slitaz()
   1.179  {
   1.180  	cat <<EOT
   1.181 +<div class="box">
   1.182  <a name="partition"></a>
   1.183 -<h4></span>$(gettext "Existing SliTaz Partition")</h4>
   1.184 -<div class="box">
   1.185 -$(gettext "Partition in use:")
   1.186 +$(gettext "Existing SliTaz partition to upgrade:")
   1.187  <select name="TGT_PARTITION">
   1.188  EOT
   1.189  	# List partitions
   1.190 @@ -342,11 +386,20 @@
   1.191  EOT
   1.192  }
   1.193  
   1.194 +select_options()
   1.195 +{
   1.196 +	cat <<EOT
   1.197 +<a name="options"></a>
   1.198 +<h4></span>$(gettext "Options")</h4>
   1.199 +EOT
   1.200 +}
   1.201 +
   1.202  select_home()
   1.203  {
   1.204  	cat <<EOT
   1.205 +<div>
   1.206  <a name="home"></a>
   1.207 -<h4>$(gettext "Home partition")</h4>
   1.208 +<h5>$(gettext "home partition")</h5>
   1.209  <input type="checkbox" name="HOME_SELECT" value="yes" $([ -n "$TGT_HOME" ] && echo "checked") id="homepart" />
   1.210  <label for="homepart">$(gettext "Use a separate partition for /home:")</label>
   1.211  <select name="TGT_HOME">
   1.212 @@ -371,38 +424,46 @@
   1.213  	do
   1.214  		echo  "<option value='$i' $([ "$i" == "$TGT_HOME_FS" ] && echo "selected")>$i</option>"
   1.215  	done
   1.216 -	echo "</select>"
   1.217 +	cat <<EOT
   1.218 +</select>
   1.219 +</div>
   1.220 +EOT
   1.221  }
   1.222  
   1.223  select_hostname()
   1.224  {
   1.225  cat << EOT
   1.226 +<div>
   1.227  <a name="hostname"></a>
   1.228 -<h4>$(gettext "Host")</h4>
   1.229 -$(gettext "Hostname:")
   1.230 +<h5>$(gettext "Hostname")</h5>
   1.231 +$(gettext "Set Hostname to:")
   1.232  <input type="text" id="hostname" name="TGT_HOSTNAME" value="$TGT_HOSTNAME" placeholder="$(gettext "Name of your system")" onkeyup="checkLogin('hostname','msgHostname'); return false;" />
   1.233  <span id="msgHostname"></span>
   1.234 +</div>
   1.235  EOT
   1.236  }
   1.237  
   1.238  select_root()
   1.239  {
   1.240  cat << EOT
   1.241 +<div class="box2">
   1.242  <a name="root"></a>
   1.243 -<h4>$(gettext "Root")</h4>
   1.244 +<h5>$(gettext "Root")</h5>
   1.245  $(gettext "Root passwd:")
   1.246  <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.247  $(gettext "Confirm password:")
   1.248  <input type="password" id="rootPwd2" value="$TGT_ROOT_PWD" placeholder="$(gettext "Password of root")" onkeyup="checkPwd('rootPwd1','rootPwd2','msgRootPwd'); return false;" />
   1.249  <span id="msgRootPwd"></span>
   1.250 +</div>
   1.251  EOT
   1.252  }
   1.253  
   1.254  select_user()
   1.255  {
   1.256  cat << EOT
   1.257 +<div class="box2">
   1.258  <a name="user"></a>
   1.259 -<h4>$(gettext "User")</h4>
   1.260 +<h5>$(gettext "User")</h5>
   1.261  $(gettext "User login:")
   1.262  <input type="text" id="user" name="TGT_USER" value="$TGT_USER" placeholder="$(gettext "Name of the first user")" onkeyup="checkLogin('user','msgUser'); return false;" />
   1.263  <span id="msgUser"></span>
   1.264 @@ -412,71 +473,29 @@
   1.265  $(gettext "Confirm password:")
   1.266  <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.267  <span id="msgUserPwd"></span>
   1.268 +</div>
   1.269  EOT
   1.270  }
   1.271  
   1.272  select_grub()
   1.273  {
   1.274  cat << EOT
   1.275 +<div>
   1.276  <a name="grub"></a>
   1.277 -<h4>$(gettext "Grub")</h4>
   1.278 +<h5>$(gettext "Grub")</h5>
   1.279  <input type="checkbox" name="TGT_GRUB" value="yes" $([ "$TGT_GRUB" == "yes" ] && echo "checked") id="grub" />
   1.280 -<label for="grub">$(gettext "Install Grub bootloader")<br /></label>
   1.281 +<label for="grub">$(gettext "Install Grub bootloader. Usually you should answer yes, unless you want to install grub by hand yourself.")<br /></label>
   1.282  <input type="checkbox" name="TGT_WINBOOT" value="auto" $([ -n "$TGT_WINBOOT" ] && echo "checked") id="dualboot" />
   1.283 -<label for="dualboot">$(gettext "Enable Windows Dual-Boot")</label>
   1.284 +<label for="dualboot">$(gettext "Enable Windows Dual-Boot.")</label>
   1.285 +</div>
   1.286  EOT
   1.287  }
   1.288  
   1.289 -validate()
   1.290 -{
   1.291 -	case $1 in
   1.292 -		install)
   1.293 -			cat << EOT
   1.294 -<script src="lib/user.js"></script>
   1.295 -<script type="text/javascript">
   1.296 -	function SubmitForm() {
   1.297 -		// hostname
   1.298 -		if (false == checkLogin('hostname','msgHostname')) {
   1.299 -			alert("Hostname error");
   1.300 -		// root pwd
   1.301 -		} else if (false == checkPwd('rootPwd1','rootPwd2','msgRootPwd')) {
   1.302 -			alert("Root password error");
   1.303 -		// user
   1.304 -		} else if (false == checkLogin('user','msgUser')) {
   1.305 -			alert("User login error");
   1.306 -		// user pwd
   1.307 -		} else if (false == checkPwd('userPwd1','userPwd2','msgUserPwd')) {
   1.308 -			alert("User password error");
   1.309 -		} else {
   1.310 -			var r=confirm("$(gettext "Do you really want to continue?")");
   1.311 -			if (r==true)
   1.312 -			{
   1.313 -				document.ConfigForm.submit();
   1.314 -			}
   1.315 -		}
   1.316 -	}
   1.317 -</script>
   1.318 -EOT
   1.319 -		;;
   1.320 -		*)
   1.321 -			cat << EOT
   1.322 -<script>
   1.323 -	function SubmitForm() {
   1.324 -		var r=confirm("$(gettext "Do you really want to continue?")");
   1.325 -		if (r==true)
   1.326 -		{
   1.327 -			document.ConfigForm.submit();
   1.328 -		}
   1.329 -	}
   1.330 -</script>
   1.331 -EOT
   1.332 -		;;
   1.333 -	esac
   1.334 -}
   1.335 -
   1.336  moveto_page()
   1.337  {
   1.338  	case $1 in
   1.339 +		partitioning)
   1.340 +			title1=$(gettext "Back to partitioning") ;;
   1.341  		*)
   1.342  			page=home
   1.343  			title1=$(gettext "Back to Installer Start Page") ;;
   1.344 @@ -496,7 +515,7 @@
   1.345  <hr />
   1.346  <input type="hidden" name="page" value="$2" />
   1.347  <a class="button" value="$1"  href="$SCRIPT_NAME?page=$1" >$title1</a>
   1.348 -<a class="button" value="$2" onclick="SubmitForm()">$title2</a>
   1.349 +<input type="submit" value="$title2">
   1.350  EOT
   1.351  }
   1.352  
   1.353 @@ -587,7 +606,49 @@
   1.354  form_start()
   1.355  {
   1.356  	cat <<EOT
   1.357 -<form name="ConfigForm" method="get" action="$SCRIPT_NAME">
   1.358 +<script src="lib/user.js"></script>
   1.359 +<script type="text/javascript">
   1.360 +	function Validate(page) {
   1.361 +		if (page == "install") {
   1.362 +			// hostname
   1.363 +			if (false == checkLogin('hostname','msgHostname')) {
   1.364 +				alert("Hostname error");
   1.365 +				return false;
   1.366 +			// root pwd
   1.367 +			} else if (false == checkPwd('rootPwd1','rootPwd2','msgRootPwd')) {
   1.368 +				alert("Root password error");
   1.369 +				return false;
   1.370 +			// user
   1.371 +			} else if (false == checkLogin('user','msgUser')) {
   1.372 +				alert("User login error");
   1.373 +				return false;
   1.374 +			// user pwd
   1.375 +			} else if (false == checkPwd('userPwd1','userPwd2','msgUserPwd')) {
   1.376 +				alert("User password error");
   1.377 +				return false;
   1.378 +			} else {
   1.379 +				var r=confirm("$(gettext "Do you really want to continue?")");
   1.380 +				if (r==true)
   1.381 +				{
   1.382 +					document.ConfigForm.submit();
   1.383 +				} else {
   1.384 +					return false;
   1.385 +				}
   1.386 +			}
   1.387 +		} else if (page == "write") {
   1.388 +			return true;
   1.389 +		} else {
   1.390 +			var r=confirm("$(gettext "Do you really want to continue?")");
   1.391 +			if (r==true)
   1.392 +			{
   1.393 +				document.ConfigForm.submit();
   1.394 +			} else {
   1.395 +				return false;
   1.396 +			}
   1.397 +		}
   1.398 +	}
   1.399 +</script>
   1.400 +<form name="ConfigForm" method="get" onsubmit="return Validate('$1')" action="$SCRIPT_NAME">
   1.401  EOT
   1.402  }
   1.403  
   1.404 @@ -601,35 +662,48 @@
   1.405  #
   1.406  
   1.407  case "$(GET page)" in
   1.408 +	home)
   1.409 +		xhtml_header
   1.410 +		select_action
   1.411 +		select_install
   1.412 +		select_upgrade
   1.413 +		;;
   1.414 +	partitioning)
   1.415 +		xhtml_header
   1.416 +		display_action install
   1.417 +		select_gparted
   1.418 +		;;
   1.419  	gparted)
   1.420  		su - -c "exec env DISPLAY=':0.0' XAUTHORITY='/var/run/slim.auth' /usr/sbin/gparted"
   1.421   		xhtml_header
   1.422 -		page_redirection home
   1.423 +		page_redirection partitioning
   1.424  		;;
   1.425  	install)
   1.426  		xhtml_header
   1.427 -		form_start
   1.428 +		form_start install
   1.429  		display_action install
   1.430 -		validate install
   1.431  		read_setup
   1.432  		select_source
   1.433 +		select_hdd
   1.434  		select_partition
   1.435 +		select_options
   1.436  		select_home
   1.437  		select_hostname
   1.438  		select_root
   1.439  		select_user
   1.440  		select_grub
   1.441 -		moveto_page home write
   1.442 +		moveto_page partitioning write
   1.443  		form_end
   1.444  		;;
   1.445  	upgrade)
   1.446  		xhtml_header
   1.447 -		form_start
   1.448 +		form_start upgrade
   1.449  		display_action upgrade
   1.450 -		validate upgrade
   1.451  		read_setup
   1.452  		select_source
   1.453 +		select_hdd
   1.454  		select_old_slitaz
   1.455 +		select_options
   1.456  		select_grub
   1.457  		moveto_page home write
   1.458  		form_end
   1.459 @@ -641,7 +715,7 @@
   1.460  			page_redirection $(GET INST_ACTION)
   1.461  		else
   1.462  			read_setup
   1.463 -			form_start
   1.464 +			form_start write
   1.465  			display_action $(GET INST_ACTION)
   1.466  			if run_tazinst; then
   1.467  				moveto_page home reboot
   1.468 @@ -653,13 +727,6 @@
   1.469  		;;
   1.470  	reboot)
   1.471  		reboot ;;
   1.472 -	home)
   1.473 -		xhtml_header
   1.474 -		select_action
   1.475 -		select_gparted
   1.476 -		select_install
   1.477 -		select_upgrade
   1.478 -		;;
   1.479  	failed)
   1.480  		xhtml_header
   1.481  		display_log
   1.482 @@ -667,7 +734,7 @@
   1.483  	menu_install)
   1.484  		xhtml_header
   1.485  		if check_ressources; then
   1.486 -			page_redirection install
   1.487 +			page_redirection partitioning
   1.488  		fi
   1.489  		;;
   1.490  	menu_upgrade)