From 970502ee66e267c383b1599d6781e45cc9eff8c1 Mon Sep 17 00:00:00 2001 From: Kroese Date: Wed, 19 Apr 2023 03:05:34 +0200 Subject: [PATCH] Check system size --- run/install.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/run/install.sh b/run/install.sh index 88ef32b..b19208b 100644 --- a/run/install.sh +++ b/run/install.sh @@ -124,13 +124,20 @@ if [ "$ALLOCATE" != "F" ]; then else - MB=(( (SYSTEM_SIZE + 1048575)/1048576 )) + MB=$(( (SYSTEM_SIZE + 1048575)/1048576 )) + echo "INFO: Writing ${MB} MB of zeroes.." dd if=/dev/zero of="${SYSTEM}" count="${MB}" bs=1M truncate -s "${SYSTEM_SIZE}" "${SYSTEM}" fi +SIZE=$(stat -c%s "${SYSTEM}") + +if [[ SIZE -ne SYSTEM_SIZE ]]; then + echo "ERROR: System disk has the wrong size." && exit 89 +fi + PART="$TMP/partition.fdisk" { echo "label: dos"