# HG changeset patch # User Dominique Corbex # Date 1335386268 -7200 # Node ID e570520a6e4ce85a9c96079d3ad0f6a9897af2e8 # Parent e436b1a8acad3ceb3418420773775f1bb78860a6 tazinst: back improved ms win detection diff -r e436b1a8acad -r e570520a6e4c installer/tazinst --- a/installer/tazinst Wed Apr 25 21:46:48 2012 +0200 +++ b/installer/tazinst Wed Apr 25 22:37:48 2012 +0200 @@ -774,20 +774,39 @@ debug "Searching for Windows" if [ "$TGT_WINBOOT" == "auto" ];then WINBOOT=$(fdisk -l | awk ' -BEGIN{disk=-1, found=-1, winboot=""} +BEGIN{ + disk=-1 + found=0 + winboot=""} { - # Counting disk - if ($1=="Disk"){disk++, part=-1} - # Counting partition - if (substr($1,1,4)=="/dev"){part++} - # Read partition Id - if ($2=="*"){Id=$6} else {Id=$5} - # Detect Windows type - if (Id=="7" || Id=="b"){ - if (found){ - # record 1st Windows partition found - winboot=sprintf("hd%d,%d",disk,part),found++} + # Count disks + if ($1=="Disk"){ + disk++ + part=-1 + dev=substr($2,6,3) + # get removable status + file="/sys/block/"dev"/removable" + "cat " file | getline removable + close("cat ") +} + # Count partitions + if (substr($1,1,4)=="/dev"){ + # List fixed drives only + if (removable==0){ + part++ + # Read partition Id + if ($2=="*"){Id=$6} else {Id=""} + # Detect Windows Partition Type: 7,b,c,e,f + WPT="[7bcef]" + if (Id ~ WPT){ + found++ + # record 1st Windows partition found + if (found==1){ + winboot=sprintf("hd%d,%d",disk,part) + } + } } + } } END{printf "%s", winboot}') if [ -z "$WINBOOT" ]; then