fix MBR size calculation

pull/1/head
tastytea 2015-10-05 01:20:00 +02:00
parent 08ef673bbb
commit 2b5bd67c9f
1 changed files with 5 additions and 1 deletions

View File

@ -96,7 +96,11 @@ if [ "${sectorsize}" == "=" ] # Older versions of util-linux
then then
sectorsize=$(LC_ALL=C fdisk -l ${MBR_DEVICE} | grep '^Units' | awk '{print $9}' ) sectorsize=$(LC_ALL=C fdisk -l ${MBR_DEVICE} | grep '^Units' | awk '{print $9}' )
fi fi
startsector=$(LC_ALL=C fdisk -l ${MBR_DEVICE} | grep -A1 'Device' | tail -n1 | awk '{print $2}' )
if [ "${startsector}" == "*" ] # If partition is marked as boot, read next field
then
startsector=$(LC_ALL=C fdisk -l ${MBR_DEVICE} | grep -A1 'Device' | tail -n1 | awk '{print $3}' ) startsector=$(LC_ALL=C fdisk -l ${MBR_DEVICE} | grep -A1 'Device' | tail -n1 | awk '{print $3}' )
fi
MBR_SIZE=$(expr ${sectorsize} \* ${startsector} / 1024) MBR_SIZE=$(expr ${sectorsize} \* ${startsector} / 1024)