osbuilder: Get mount directory size with Mb format

While calculating directory size in imagebuild script, we shoul use
`df -BM` instead of `df -h` to keep Mb format.

Fixes #336

image-builder: get mount directory size with Mb format

Signed-off-by: ClarkLee <clarklee1992@hotmail.com>
This commit is contained in:
ClarkLee 2019-06-28 16:59:32 +08:00 committed by Clark Lee
parent 0c48630395
commit 6d5aef531a

View File

@ -233,7 +233,7 @@ calculate_required_disk_size() {
die "Could not format loop device: ${device}"
fi
mount "${device}p1" "${mount_dir}"
avail="$(df -h --output=avail "${mount_dir}" | tail -n1 | sed 's/[M ]//g')"
avail="$(df -BM --output=avail "${mount_dir}" | tail -n1 | sed 's/[M ]//g')"
umount "${mount_dir}"
losetup -d "${device}"