tazpanel rev 458

boot.cgi/ISO mine: install in Linux partition
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Apr 13 11:11:51 2015 +0200 (2015-04-13)
parents 01289ab85829
children 5d33b8aaf36d
files boot.cgi
line diff
     1.1 --- a/boot.cgi	Mon Apr 13 11:51:42 2015 +0300
     1.2 +++ b/boot.cgi	Mon Apr 13 11:11:51 2015 +0200
     1.3 @@ -28,6 +28,15 @@
     1.4  EOT
     1.5  }
     1.6  
     1.7 +disksize()
     1.8 +{
     1.9 +	size=$(($(cat /sys/block/$1/size)/2048))
    1.10 +	for i in MB GB TB ; do
    1.11 +		[ $size -lt 2048 ] && break
    1.12 +		size=$(((512+$size)/1024))
    1.13 +	done
    1.14 +	echo "$size$i"
    1.15 +}
    1.16  
    1.17  #
    1.18  # Commands
    1.19 @@ -398,20 +407,24 @@
    1.20  		</td>
    1.21  		<td><input type="text" name="iso" value="$iso" size="50"/></td></tr>
    1.22  	<tr><td>Working directory</td>
    1.23 -		<td><input type="text" name="workdir" value="$workdir"/></td></tr>
    1.24 -	<tr><td>Windows partition</td>
    1.25 +		<td><input type="text" name="workdir" value="$workdir" size="50"/></td></tr>
    1.26 +	<tr><td>Target partition
    1.27 +			<span data-img="info" title="For hard disk installation only. Will create /slitaz tree and keep other files. No partitioning and no formatting."></span>
    1.28 +		</td>
    1.29  		<td><select name="instdev">
    1.30  			<option value="/dev/null">Choose a partition (optional)</option>
    1.31  EOT
    1.32 -		blkid | grep -iE "(msdos|vfat|ntfs)" | \
    1.33 -		sed 's|^/dev/\(.*\):.*LABEL="\([^"]*\).*|\1 "\2"|' | \
    1.34 -		while read dev label; do
    1.35 +		blkid | grep -iE "(msdos|vfat|ntfs|ext[234]|xfs|btrfs)" | \
    1.36 +		sed 's|^/dev/\(.*\):.*LABEL="\([^"]*\).* TYPE="\([^"]*\).*|\1 "\2" \3|' | \
    1.37 +		while read dev label type; do
    1.38  			echo -n "<option value=\"/dev/$dev\">/dev/$dev $label "
    1.39 -			echo "$(($(cat /sys/block/${dev:0:3}/$dev/size)/2048))MB</option>"
    1.40 +			echo "$(disksize ${dev:0:3}/$dev) $type</option>"
    1.41  		done 
    1.42  		cat <<EOT
    1.43  			</select></td></tr>
    1.44 -	<tr><td>USB key device</td>
    1.45 +	<tr><td>USB key device
    1.46 +			<span data-img="info" title="For USB boot key only. Will erase the full device."></span>
    1.47 +		</td>
    1.48  		<td><select name="usbkeydev">
    1.49  			<option value="/dev/null">Choose a USB key (optional)</option>
    1.50  EOT
    1.51 @@ -419,7 +432,7 @@
    1.52  		sed 's|/sys/block/\(.*\)/removable|\1|' | while read dev; do
    1.53  			grep -qs 1 /sys/block/$DEV/ro && continue
    1.54  			echo -n "<option value=\"/dev/$dev\">/dev/$dev "
    1.55 -			echo "$(($(cat /sys/block/$dev/size)/2048))MB $(cat \
    1.56 +			echo "$(disksize $dev) $(cat \
    1.57  				/sys/block/$i/device/model 2>/dev/null)</option>"
    1.58  		done
    1.59  		cat <<EOT