From 7998d931bbace1b2cd4e25c19880bfee8d509b0c Mon Sep 17 00:00:00 2001 From: Kroese Date: Sat, 13 Jan 2024 00:02:52 +0100 Subject: [PATCH] feat: Change raw allocation (#320) --- src/disk.sh | 8 ++++++++ src/reset.sh | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/disk.sh b/src/disk.sh index 9a835d7..165f5b2 100644 --- a/src/disk.sh +++ b/src/disk.sh @@ -433,6 +433,14 @@ fi DISK_EXT="$(fmt2ext "$DISK_FMT")" || exit $? +if [ -z "$ALLOCATE" ]; then + if [[ "${DISK_FMT,,}" == "raw" ]]; then + ALLOCATE="Y" + else + ALLOCATE="N" + fi +fi + if [[ "$ALLOCATE" == [Nn]* ]]; then DISK_TYPE="growable" DISK_ALLOC="preallocation=off" diff --git a/src/reset.sh b/src/reset.sh index 6690538..8b1cb5d 100644 --- a/src/reset.sh +++ b/src/reset.sh @@ -12,8 +12,8 @@ trap 'error "Status $? while: $BASH_COMMAND (line $LINENO/$BASH_LINENO)"' ERR # Docker environment variables : ${BOOT:=''} # URL of the ISO file -: ${DEBUG:='N'} # Disable debugging mode -: ${ALLOCATE:='N'} # Disable preallocation +: ${DEBUG:='N'} # Disable debugging +: ${ALLOCATE:=''} # Preallocate diskspace : ${ARGUMENTS:=''} # Extra QEMU parameters : ${CPU_CORES:='1'} # Amount of CPU cores : ${RAM_SIZE:='1G'} # Maximum RAM amount