slitaz-tools rev 735
tazinst: back improved ms win detection
author | Dominique Corbex <domcox@slitaz.org> |
---|---|
date | Wed Apr 25 22:37:48 2012 +0200 (2012-04-25) |
parents | e436b1a8acad |
children | 96a05e0a165d |
files | installer/tazinst |
line diff
1.1 --- a/installer/tazinst Wed Apr 25 21:46:48 2012 +0200 1.2 +++ b/installer/tazinst Wed Apr 25 22:37:48 2012 +0200 1.3 @@ -774,20 +774,39 @@ 1.4 debug "Searching for Windows" 1.5 if [ "$TGT_WINBOOT" == "auto" ];then 1.6 WINBOOT=$(fdisk -l | awk ' 1.7 -BEGIN{disk=-1, found=-1, winboot=""} 1.8 +BEGIN{ 1.9 + disk=-1 1.10 + found=0 1.11 + winboot=""} 1.12 { 1.13 - # Counting disk 1.14 - if ($1=="Disk"){disk++, part=-1} 1.15 - # Counting partition 1.16 - if (substr($1,1,4)=="/dev"){part++} 1.17 - # Read partition Id 1.18 - if ($2=="*"){Id=$6} else {Id=$5} 1.19 - # Detect Windows type 1.20 - if (Id=="7" || Id=="b"){ 1.21 - if (found){ 1.22 - # record 1st Windows partition found 1.23 - winboot=sprintf("hd%d,%d",disk,part),found++} 1.24 + # Count disks 1.25 + if ($1=="Disk"){ 1.26 + disk++ 1.27 + part=-1 1.28 + dev=substr($2,6,3) 1.29 + # get removable status 1.30 + file="/sys/block/"dev"/removable" 1.31 + "cat " file | getline removable 1.32 + close("cat ") 1.33 +} 1.34 + # Count partitions 1.35 + if (substr($1,1,4)=="/dev"){ 1.36 + # List fixed drives only 1.37 + if (removable==0){ 1.38 + part++ 1.39 + # Read partition Id 1.40 + if ($2=="*"){Id=$6} else {Id=""} 1.41 + # Detect Windows Partition Type: 7,b,c,e,f 1.42 + WPT="[7bcef]" 1.43 + if (Id ~ WPT){ 1.44 + found++ 1.45 + # record 1st Windows partition found 1.46 + if (found==1){ 1.47 + winboot=sprintf("hd%d,%d",disk,part) 1.48 + } 1.49 + } 1.50 } 1.51 + } 1.52 } 1.53 END{printf "%s", winboot}') 1.54 if [ -z "$WINBOOT" ]; then