feat: Detect changed ISO files

This commit is contained in:
Kroese 2024-05-02 12:10:06 +02:00 committed by GitHub
parent face13d3de
commit 4a9659e57b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -64,7 +64,10 @@ startInstall() {
fi fi
if skipInstall; then if skipInstall; then
if [ ! -f "$STORAGE/$BASE" ]; then
BASE="custom.iso"
[ ! -f "$STORAGE/$BASE" ] && BASE="" [ ! -f "$STORAGE/$BASE" ] && BASE=""
fi
[[ "${PLATFORM,,}" == "arm64" ]] && VGA="virtio-gpu" [[ "${PLATFORM,,}" == "arm64" ]] && VGA="virtio-gpu"
return 1 return 1
fi fi
@ -164,6 +167,7 @@ abortInstall() {
detectCustom() { detectCustom() {
CUSTOM=$(find "$STORAGE" -maxdepth 1 -type f -iname windows.iso -printf "%f\n" | head -n 1) 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 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 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) [ -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) CUSTOM=$(find "$STORAGE" -maxdepth 1 -type f -iname "$FN" -printf "%f\n" | head -n 1)
fi 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 return 0
} }
@ -923,7 +934,8 @@ if ! updateImage "$ISO" "$DIR" "$XML"; then
fi fi
if ! rm -f "$ISO" 2> /dev/null; then if ! rm -f "$ISO" 2> /dev/null; then
BASE="windows.iso" size="$(stat -c%s "$ISO")"
BASE="windows_$size.iso"
ISO="$STORAGE/$BASE" ISO="$STORAGE/$BASE"
rm -f "$ISO" rm -f "$ISO"
fi fi