less verbose image creation

This commit is contained in:
Pratham Patel 2023-11-20 22:19:51 +05:30
parent cb2cd90c01
commit 0ee5dab457
No known key found for this signature in database

View File

@ -33,7 +33,7 @@ function create_new_image {
UBOOT_MAX_SIZE='64' UBOOT_MAX_SIZE='64'
IMAGE_SIZE=$(( $(stat -c '%s' "${IMAGE_NAME}") / 1024 / 1024 )) IMAGE_SIZE=$(( $(stat -c '%s' "${IMAGE_NAME}") / 1024 / 1024 ))
NEW_IMAGE_NAME="${IMAGE_NAME}.new" NEW_IMAGE_NAME="${IMAGE_NAME}.new"
truncate -s "$(( IMAGE_SIZE + (UBOOT_MAX_SIZE * 2) ))"MiB "${NEW_IMAGE_NAME}" truncate -s "$(( IMAGE_SIZE + UBOOT_MAX_SIZE ))"MiB "${NEW_IMAGE_NAME}"
LOOPBACK_01=$(losetup -f -P --show "${IMAGE_NAME}") LOOPBACK_01=$(losetup -f -P --show "${IMAGE_NAME}")
LOOPBACK_02=$(losetup -f -P --show "${NEW_IMAGE_NAME}") LOOPBACK_02=$(losetup -f -P --show "${NEW_IMAGE_NAME}")
@ -69,8 +69,6 @@ EOF
losetup -d "${LOOPBACK_02}" losetup -d "${LOOPBACK_02}"
losetup -d "${LOOPBACK_01}" losetup -d "${LOOPBACK_01}"
fdisk -l "${IMAGE_NAME}"
fdisk -l "${NEW_IMAGE_NAME}"
mv "${NEW_IMAGE_NAME}" "${IMAGE_NAME}" mv "${NEW_IMAGE_NAME}" "${IMAGE_NAME}"
sync; sync; sync; sync; sync; sync; sync; sync;
sleep 10 sleep 10