fix: Verify boot image exists (#137)
Some checks are pending
Build / Test (push) Waiting to run
Build / Build (push) Blocked by required conditions

This commit is contained in:
Kroese 2024-05-28 01:22:51 +02:00 committed by GitHub
parent f00a164c81
commit f1ff8cd343
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 38 additions and 32 deletions

View file

@ -33,7 +33,7 @@ parseVersion() {
"ltsc11" | "11ltsc" | "win11-ltsc" | "win11arm64-ltsc" | "win11arm64-enterprise-ltsc-eval" )
VERSION="win11arm64-enterprise-ltsc-eval"
[ -z "$DETECTED" ] && DETECTED="win11arm64-ltsc"
;;
;;
"10" | "10p" | "win10" | "win10p" | "windows10" | "windows 10" )
VERSION="win10arm64"
;;
@ -537,7 +537,7 @@ getLink1() {
[[ "${lang,,}" != "en" ]] && [[ "${lang,,}" != "en-us" ]] && return 0
size=4430471168
sum="d265df49b30a1477d010c79185a7bc88591a1be4b3eb690c994bed828ea17c00"
url="en-us_windows_10_iot_enterprise_ltsc_2021_arm64_dvd_e8d4fc46.iso"
url="en-us_windows_10_iot_enterprise_ltsc_2021_arm64_dvd_e8d4fc46.iso"
;;
esac
@ -575,12 +575,12 @@ getLink2() {
size=4821989376
sum="e8f1431c4e6289b3997c20eadbb2576670300bb6e1cf8948b5d7af179010a962"
url="11/26100.1.240331-1435.ge_release_CLIENT_ENTERPRISES_OEM_A64FRE_en-us.iso"
;;
;;
"win10arm64" | "win10arm64-enterprise" | "win10arm64-enterprise-eval" )
size=4846794752
sum="6d2688f95fa1d359d68ed0c38c3f38de7b3713c893410e15be9d1e706a4a58c7"
url="10/en-us_windows_10_22h2_arm64.iso"
;;
;;
"win10arm64-ltsc" | "win10arm64-enterprise-ltsc-eval" )
size=4430471168
sum="d265df49b30a1477d010c79185a7bc88591a1be4b3eb690c994bed828ea17c00"
@ -687,8 +687,16 @@ migrateFiles() {
return 0
}
skipVersion() {
return 1
}
detectLegacy() {
return 1
}
prepareLegacy() {
return 1
}
return 0

View file

@ -489,19 +489,6 @@ setXML() {
return 0
}
skipVersion() {
local version="$1"
case "${version,,}" in
"win2k"* | "winxp"* | "win9"* )
return 0
;;
esac
return 1
}
detectImage() {
local dir="$1"
@ -588,17 +575,19 @@ prepareImage() {
local iso="$1"
local dir="$2"
local missing
local desc missing
desc=$(printVersion "$DETECTED" "$DETECTED")
case "${DETECTED,,}" in
"win9"* | "win2k"* )
MACHINE="pc-i440fx-2.4" ;;
"winxp"* | "winvistax86"* | "win7x86"* )
"winvistax86"* | "win7x86"* | "winxp"* | "win2003"* )
MACHINE="pc-q35-2.10" ;;
esac
case "${DETECTED,,}" in
"win9"* | "winxp"* | "win2k"* )
"win9"* | "win2k"* | "winxp"* | "win2003"* )
HV="N"
BOOT_MODE="windows_legacy" ;;
"winvista"* | "win7"* | "win2008"* )
@ -606,18 +595,22 @@ prepareImage() {
esac
case "${DETECTED,,}" in
"winxp"* )
DISK_TYPE="blk"
prepareXP "$iso" "$dir" && return 0
error "Failed to prepare Windows XP ISO!" && return 1 ;;
"win9"* )
DISK_TYPE="auto"
prepare9x "$iso" "$dir" && return 0
error "Failed to prepare Windows 9x ISO!" && return 1 ;;
prepare9x "$iso" "$dir" "$desc" && return 0
error "Failed to prepare $desc ISO!" && return 1 ;;
"win2k"* )
DISK_TYPE="auto"
prepare2k "$iso" "$dir" && return 0
error "Failed to prepare Windows 2000 ISO!" && return 1 ;;
prepare2k "$iso" "$dir" "$desc" && return 0
error "Failed to prepare $desc ISO!" && return 1 ;;
"winxp"* )
DISK_TYPE="blk"
prepareXP "$iso" "$dir" "$desc" && return 0
error "Failed to prepare $desc ISO!" && return 1 ;;
"win2003"* )
DISK_TYPE="blk"
prepare2k3 "$iso" "$dir" "$desc" && return 0
error "Failed to prepare $desc ISO!" && return 1 ;;
esac
if [[ "${BOOT_MODE,,}" != "windows_legacy" ]]; then
@ -627,13 +620,13 @@ prepareImage() {
missing=$(basename "$dir/$EFISYS")
[ ! -f "$dir/$ETFS" ] && missing=$(basename "$dir/$ETFS")
error "failed to locate file '${missing,,}' in ISO image!"
error "Failed to locate file \"${missing,,}\" in $desc ISO image!"
return 1
fi
prepareLegacy "$iso" "$dir" && return 0
prepareLegacy "$iso" "$dir" "$desc" && return 0
error "Failed to extract boot image from ISO!"
error "Failed to extract boot image from $desc ISO image!"
return 1
}
@ -702,6 +695,7 @@ addDriver() {
"win81x64"* ) folder="w10/amd64" ;;
"win10x64"* ) folder="w10/amd64" ;;
"win11x64"* ) folder="w11/amd64" ;;
"win2025"* ) folder="2k22/amd64" ;;
"win2022"* ) folder="2k22/amd64" ;;
"win2019"* ) folder="2k19/amd64" ;;
"win2016"* ) folder="2k16/amd64" ;;
@ -933,6 +927,10 @@ buildImage() {
error "File $BOOT does already exist?!" && return 1
fi
if [ ! -f "$dir/$ETFS" ]; then
error "Failed to locate file \"$ETFS\" in ISO image!" && return 1
fi
base=$(basename "$BOOT")
local out="$TMP/${base%.*}.tmp"
rm -f "$out"
@ -961,7 +959,7 @@ buildImage() {
else
case "${DETECTED,,}" in
"win2k"* | "winxp"* )
"win2k"* | "winxp"* | "win2003"* )
! genisoimage -o "$out" -b "$ETFS" -no-emul-boot -boot-load-seg 1984 -boot-load-size 4 -c "$cat" -iso-level 2 -J -l -D -N -joliet-long \
-relaxed-filenames -V "${LABEL::30}" -quiet "$dir" 2> "$log" && failed="y" ;;
"win9"* )