From 4d1c1c476b24e16ea2fbe378ecf59a22308caced Mon Sep 17 00:00:00 2001 From: Kroese Date: Wed, 13 Nov 2024 00:26:59 +0100 Subject: [PATCH] feat: Support image commit (#156) --- src/reset.sh | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/src/reset.sh b/src/reset.sh index 012a5ee..07fc2e0 100644 --- a/src/reset.sh +++ b/src/reset.sh @@ -15,24 +15,25 @@ echo "❯ For support visit $SUPPORT" # Docker environment variables -: "${BOOT:=""}" # URL of the ISO file -: "${DEBUG:="N"}" # Disable debugging -: "${MACHINE:="virt"}" # Machine selection -: "${ALLOCATE:=""}" # Preallocate diskspace -: "${ARGUMENTS:=""}" # Extra QEMU parameters -: "${CPU_CORES:="1"}" # Amount of CPU cores -: "${RAM_SIZE:="1G"}" # Maximum RAM amount -: "${RAM_CHECK:="Y"}" # Check available RAM -: "${DISK_SIZE:="16G"}" # Initial data disk size -: "${BOOT_MODE:=""}" # Boot system with UEFI -: "${BOOT_INDEX:="9"}" # Boot index of CD drive +: "${BOOT:=""}" # URL of the ISO file +: "${DEBUG:="N"}" # Disable debugging +: "${COMMIT:="N"}" # Commit to image +: "${MACHINE:="virt"}" # Machine selection +: "${ALLOCATE:=""}" # Preallocate diskspace +: "${ARGUMENTS:=""}" # Extra QEMU parameters +: "${CPU_CORES:="1"}" # Amount of CPU cores +: "${RAM_SIZE:="1G"}" # Maximum RAM amount +: "${RAM_CHECK:="Y"}" # Check available RAM +: "${DISK_SIZE:="16G"}" # Initial data disk size +: "${BOOT_MODE:=""}" # Boot system with UEFI +: "${BOOT_INDEX:="9"}" # Boot index of CD drive +: "${STORAGE:="/storage"}" # Storage folder location # Helper variables PROCESS="${APP,,}" PROCESS="${PROCESS// /-}" -STORAGE="/storage" INFO="/run/shm/msg.html" PAGE="/run/shm/index.html" TEMPLATE="/var/www/index.html" @@ -80,8 +81,13 @@ fi # Check folder -if [ ! -d "$STORAGE" ]; then - error "Storage folder ($STORAGE) not found!" && exit 13 +if [[ "$COMMIT" != [Nn]* ]]; then + STORAGE="/local" + mkdir -p "$STORAGE" +else + if [ ! -d "$STORAGE" ]; then + error "Storage folder ($STORAGE) not found!" && exit 13 + fi fi # Read memory