From ae89a9bc4cbeed8c7f6dc1fc87ba37d5dec9e74e Mon Sep 17 00:00:00 2001 From: Kroese Date: Fri, 16 Feb 2024 13:33:54 +0100 Subject: [PATCH] fix: Find files case insensitive --- src/install.sh | 40 +++++----------------------------------- 1 file changed, 5 insertions(+), 35 deletions(-) diff --git a/src/install.sh b/src/install.sh index 07638db..91982bd 100644 --- a/src/install.sh +++ b/src/install.sh @@ -15,15 +15,8 @@ fi [[ "${VERSION,,}" == "10" ]] && VERSION="win10arm64" [[ "${VERSION,,}" == "win10" ]] && VERSION="win10arm64" -CUSTOM="custom.iso" - -[ ! -f "$STORAGE/$CUSTOM" ] && CUSTOM="Custom.iso" -[ ! -f "$STORAGE/$CUSTOM" ] && CUSTOM="custom.ISO" -[ ! -f "$STORAGE/$CUSTOM" ] && CUSTOM="CUSTOM.ISO" -[ ! -f "$STORAGE/$CUSTOM" ] && CUSTOM="custom.img" -[ ! -f "$STORAGE/$CUSTOM" ] && CUSTOM="Custom.img" -[ ! -f "$STORAGE/$CUSTOM" ] && CUSTOM="custom.IMG" -[ ! -f "$STORAGE/$CUSTOM" ] && CUSTOM="CUSTOM.IMG" +CUSTOM=$(find "$STORAGE" -maxdepth 1 -type f -iname custom.iso | head -n 1 | xargs basename) +[ -z "$CUSTOM" ] && CUSTOM=$(find "$STORAGE" -maxdepth 1 -type f -iname custom.img | head -n 1 | xargs basename) ESD_URL="" TMP="$STORAGE/tmp" @@ -72,31 +65,6 @@ getVersion() { return 0 } -replaceXML() { - - local dir="$1" - local asset="$2" - - local path="$dir/autounattend.xml" - [ -f "$path" ] && cp "$asset" "$path" - path="$dir/Autounattend.xml" - [ -f "$path" ] && cp "$asset" "$path" - path="$dir/AutoUnattend.xml" - [ -f "$path" ] && cp "$asset" "$path" - path="$dir/autounattend.XML" - [ -f "$path" ] && cp "$asset" "$path" - path="$dir/Autounattend.XML" - [ -f "$path" ] && cp "$asset" "$path" - path="$dir/AutoUnattend.XML" - [ -f "$path" ] && cp "$asset" "$path" - path="$dir/AUTOUNATTEND.xml" - [ -f "$path" ] && cp "$asset" "$path" - path="$dir/AUTOUNATTEND.XML" - [ -f "$path" ] && cp "$asset" "$path" - - return 0 -} - hasDisk() { [ -b "${DEVICE:-}" ] && return 0 @@ -581,7 +549,9 @@ updateImage() { local index result [ ! -f "$asset" ] && return 0 - replaceXML "$dir" "$asset" + + local path=$(find "$dir" -maxdepth 1 -type f -iname autounattend.xml | head -n 1) + [ -n "$path" ] && cp "$asset" "$path" local loc="$dir/sources/boot.wim" [ ! -f "$loc" ] && loc="$dir/sources/boot.esd"