# HG changeset patch # User Dominique Corbex # Date 1334817758 -7200 # Node ID f1ba248d0b5465db10e1592b9f46a9e94be3f3ef # Parent fb636ac549ab965a4aa55c87274cf4618a86ead2 tazinst: improved ms-windows detection diff -r fb636ac549ab -r f1ba248d0b54 installer/tazinst --- a/installer/tazinst Thu Apr 12 11:03:44 2012 +0200 +++ b/installer/tazinst Thu Apr 19 08:42:38 2012 +0200 @@ -20,7 +20,7 @@ # 7: Another instance is running # 8: Internal error -VERSION=3.32 +VERSION=3.33 # Internationalization . /usr/bin/gettext.sh @@ -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