Always allocate

This commit is contained in:
Kroese 2023-04-19 06:59:52 +02:00 committed by GitHub
parent 13bd4c60ea
commit c3291e6eaa

View File

@ -103,7 +103,7 @@ BOOT=$(find $TMP -name "*.bin.zip")
BOOT=$(echo "$BOOT" | head -c -5) BOOT=$(echo "$BOOT" | head -c -5)
unzip -q -o "$BOOT".zip -d $TMP unzip -q -o "$BOOT".zip -d $TMP
echo "Install: Creating partition table..." echo "Install: Allocating diskspace..."
SYSTEM="$TMP/sys.img" SYSTEM="$TMP/sys.img"
SYSTEM_SIZE=4954537983 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 echo "ERROR: Not enough free space to create a 4 GB system disk." && exit 87
fi 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 dd if=/dev/urandom of="${SYSTEM}" count="${SYSTEM_SIZE}" bs=1M iflag=count_bytes status=none
# Check if file exists # 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 echo "ERROR: System disk has the wrong size: ${SIZE}" && exit 90
fi fi
echo "Install: Creating partition table..."
PART="$TMP/partition.fdisk" PART="$TMP/partition.fdisk"
{ echo "label: dos" { echo "label: dos"