aboutsummaryrefslogtreecommitdiffstats
path: root/export-image/prerun.sh
diff options
context:
space:
mode:
authorSerge Schneider <[email protected]>2017-11-24 07:33:03 +0000
committerSerge Schneider <[email protected]>2017-11-24 10:12:08 +0000
commitaa8731012ea96de610aa51c42462d2a7b2a020d0 (patch)
treeed98920aa04acbd1a74187f3bd992c59c6453642 /export-image/prerun.sh
parent53259b48d3053d135f6a2eacdbe245d6d2c01b53 (diff)
Round image size up to nearest 4M block
Diffstat (limited to 'export-image/prerun.sh')
-rwxr-xr-xexport-image/prerun.sh3
1 files changed, 2 insertions, 1 deletions
diff --git a/export-image/prerun.sh b/export-image/prerun.sh
index 8104f45..cec133c 100755
--- a/export-image/prerun.sh
+++ b/export-image/prerun.sh
@@ -12,7 +12,8 @@ mkdir -p ${ROOTFS_DIR}
BOOT_SIZE=$(du --apparent-size -s ${EXPORT_ROOTFS_DIR}/boot --block-size=1 | cut -f 1)
TOTAL_SIZE=$(du --apparent-size -s ${EXPORT_ROOTFS_DIR} --exclude var/cache/apt/archives --block-size=1 | cut -f 1)
-IMG_SIZE=$((BOOT_SIZE + TOTAL_SIZE + (800 * 1024 * 1024)))
+ROUND_SIZE="$((4 * 1024 * 1024))"
+IMG_SIZE=$(((BOOT_SIZE + TOTAL_SIZE + (800 * 1024 * 1024) + ROUND_SIZE) / ROUND_SIZE * ROUND_SIZE))
truncate -s ${IMG_SIZE} ${IMG_FILE}
fdisk -H 255 -S 63 ${IMG_FILE} <<EOF