mirror of https://schlomp.space/tastytea/hashboot
Fix mbr_size() for older versions of util_linux
parent
75937e1f51
commit
59737fb019
|
@ -49,8 +49,13 @@ read_config ()
|
||||||
mbr_size ()
|
mbr_size ()
|
||||||
{
|
{
|
||||||
# Find out where the first partition starts returns(prints) size in KiB
|
# Find out where the first partition starts returns(prints) size in KiB
|
||||||
sectorsize=$(LC_ALL=C fdisk -l /dev/sda | grep '^Units:' | awk '{print $8}')
|
sectorsize=$(LC_ALL=C fdisk -l ${MBR_DEVICE} | grep '^Units' | awk '{print $8}')
|
||||||
startsector=$(LC_ALL=C fdisk -l /dev/sda | grep -A1 '^Device' | tail -n1 | awk '{print $3}')
|
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}')
|
||||||
|
|
||||||
expr ${sectorsize} \* ${startsector} / 1024
|
expr ${sectorsize} \* ${startsector} / 1024
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue