init: fix offset calculation after busybox fdisk change

This commit is contained in:
MilhouseVH 2017-12-04 00:49:10 +00:00
parent 7ab73457b8
commit 4bc97b2aa9

View File

@ -876,7 +876,7 @@
losetup $LOOP $IMG_FILE
# check for MBR partititon
OFFSET=$(fdisk -u -l $LOOP 2>/dev/null | awk '/^[ ]*Device/{part=1; next}; part{if ($2 == "*") {print $3} else {print $2} ; exit}')
OFFSET=$(fdisk -u -l $LOOP 2>/dev/null | awk '/^[ ]*Device/{part=1; next}; part{if ($2 == "*") {print $5} else {print $4} ; exit}')
if [ -z "$OFFSET" ]; then
# check for GPT partititon
OFFSET=$(fdisk -u -l $LOOP 2>/dev/null | awk '/^Number/{part=1; next}; part{print $2; exit}')