From 4a9659e57b80383a726e8ee89a13a57ac3977841 Mon Sep 17 00:00:00 2001 From: Kroese Date: Thu, 2 May 2024 12:10:06 +0200 Subject: [PATCH] feat: Detect changed ISO files --- src/install.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/install.sh b/src/install.sh index e916eaf..6a248aa 100644 --- a/src/install.sh +++ b/src/install.sh @@ -64,7 +64,10 @@ startInstall() { fi if skipInstall; then - [ ! -f "$STORAGE/$BASE" ] && BASE="" + if [ ! -f "$STORAGE/$BASE" ]; then + BASE="custom.iso" + [ ! -f "$STORAGE/$BASE" ] && BASE="" + fi [[ "${PLATFORM,,}" == "arm64" ]] && VGA="virtio-gpu" return 1 fi @@ -164,6 +167,7 @@ abortInstall() { detectCustom() { CUSTOM=$(find "$STORAGE" -maxdepth 1 -type f -iname windows.iso -printf "%f\n" | head -n 1) + [ -z "$CUSTOM" ] && CUSTOM=$(find "$STORAGE" -maxdepth 1 -type f -iname custom.iso -printf "%f\n" | head -n 1) [ -z "$CUSTOM" ] && CUSTOM=$(find "$STORAGE" -maxdepth 1 -type f -iname boot.iso -printf "%f\n" | head -n 1) [ -z "$CUSTOM" ] && CUSTOM=$(find "$STORAGE" -maxdepth 1 -type f -iname custom.img -printf "%f\n" | head -n 1) @@ -174,6 +178,13 @@ detectCustom() { CUSTOM=$(find "$STORAGE" -maxdepth 1 -type f -iname "$FN" -printf "%f\n" | head -n 1) fi + if [ -n "$CUSTOM" ]; then + local size + size="$(stat -c%s "$STORAGE/$CUSTOM")" + local file="windows_$size.iso" + [ -f "$STORAGE/$file" ] && CUSTOM="$file" + fi + return 0 } @@ -923,7 +934,8 @@ if ! updateImage "$ISO" "$DIR" "$XML"; then fi if ! rm -f "$ISO" 2> /dev/null; then - BASE="windows.iso" + size="$(stat -c%s "$ISO")" + BASE="windows_$size.iso" ISO="$STORAGE/$BASE" rm -f "$ISO" fi