mirror of
https://schlomp.space/tastytea/hashboot
synced 2024-11-16 14:37:06 +01:00
Fix mbr_size() for older versions of util_linux
This commit is contained in:
parent
75937e1f51
commit
59737fb019
@ -49,8 +49,13 @@ read_config ()
|
||||
mbr_size ()
|
||||
{
|
||||
# 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}')
|
||||
startsector=$(LC_ALL=C fdisk -l /dev/sda | grep -A1 '^Device' | tail -n1 | awk '{print $3}')
|
||||
sectorsize=$(LC_ALL=C fdisk -l ${MBR_DEVICE} | grep '^Units' | awk '{print $8}')
|
||||
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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user