use a +1MiB of extra space for each "dd"-ed partition

This commit is contained in:
Pratham Patel 2023-11-20 17:40:28 +05:30
parent fead388d05
commit e99df742a1
No known key found for this signature in database
1 changed files with 3 additions and 2 deletions

View File

@ -23,8 +23,9 @@ function create_new_image {
LOOPBACK_01=$(losetup -f -P --show "${IMAGE_NAME}")
LOOPBACK_02=$(losetup -f -P --show "${NEW_IMAGE_NAME}")
UEFI_SECTORS="$(fdisk -l "${LOOPBACK_01}" | grep "${LOOPBACK_01}p1" | awk '{print $4}')"
BOOT_SECTORS="$(fdisk -l "${LOOPBACK_01}" | grep "${LOOPBACK_01}p2" | awk '{print $4}')"
# 1 MiB = 2048 * (1 block/sector (512 bytes))
UEFI_SECTORS="$(( $(fdisk -l "${LOOPBACK_01}" | grep "${LOOPBACK_01}p1" | awk '{print $4}') + 2048 ))"
BOOT_SECTORS="$(( $(fdisk -l "${LOOPBACK_01}" | grep "${LOOPBACK_01}p2" | awk '{print $4}') + 2048 ))"
cat << EOF | fdisk "${LOOPBACK_02}"
g