From 2b5bd67c9fa1135398747a17248f44ffc08e28ac Mon Sep 17 00:00:00 2001 From: tastytea Date: Mon, 5 Oct 2015 01:20:00 +0200 Subject: [PATCH] fix MBR size calculation --- hashboot | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hashboot b/hashboot index c590a15..425ca3f 100755 --- a/hashboot +++ b/hashboot @@ -96,7 +96,11 @@ if [ "${sectorsize}" == "=" ] # Older versions of util-linux then sectorsize=$(LC_ALL=C fdisk -l ${MBR_DEVICE} | grep '^Units' | awk '{print $9}' ) fi -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 $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}' ) +fi MBR_SIZE=$(expr ${sectorsize} \* ${startsector} / 1024)