From c3291e6eaaf032dd848e5f86f07a2d8c901a8a0f Mon Sep 17 00:00:00 2001 From: Kroese Date: Wed, 19 Apr 2023 06:59:52 +0200 Subject: [PATCH] Always allocate --- run/install.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/run/install.sh b/run/install.sh index 973d3a3..f4baa05 100644 --- a/run/install.sh +++ b/run/install.sh @@ -103,7 +103,7 @@ BOOT=$(find $TMP -name "*.bin.zip") BOOT=$(echo "$BOOT" | head -c -5) unzip -q -o "$BOOT".zip -d $TMP -echo "Install: Creating partition table..." +echo "Install: Allocating diskspace..." SYSTEM="$TMP/sys.img" SYSTEM_SIZE=4954537983 @@ -115,7 +115,11 @@ if (( SYSTEM_SIZE > SPACE )); then echo "ERROR: Not enough free space to create a 4 GB system disk." && exit 87 fi -echo "Install: Allocating diskspace..." +if ! fallocate -l "${SYSTEM_SIZE}" "${SYSTEM}"; then + rm -f "${SYSTEM}" + echo "ERROR: Could not allocate a file for the system disk." && exit 88 +fi + dd if=/dev/urandom of="${SYSTEM}" count="${SYSTEM_SIZE}" bs=1M iflag=count_bytes status=none # Check if file exists @@ -131,6 +135,8 @@ if [[ SIZE -ne SYSTEM_SIZE ]]; then echo "ERROR: System disk has the wrong size: ${SIZE}" && exit 90 fi +echo "Install: Creating partition table..." + PART="$TMP/partition.fdisk" { echo "label: dos"