mirror of
https://github.com/dockur/windows-arm.git
synced 2024-11-16 18:21:48 +00:00
fix: Verify boot image exists (#137)
This commit is contained in:
parent
f00a164c81
commit
f1ff8cd343
2 changed files with 38 additions and 32 deletions
|
@ -687,8 +687,16 @@ migrateFiles() {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
skipVersion() {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
detectLegacy() {
|
detectLegacy() {
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prepareLegacy() {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
|
@ -489,19 +489,6 @@ setXML() {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
skipVersion() {
|
|
||||||
|
|
||||||
local version="$1"
|
|
||||||
|
|
||||||
case "${version,,}" in
|
|
||||||
"win2k"* | "winxp"* | "win9"* )
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
detectImage() {
|
detectImage() {
|
||||||
|
|
||||||
local dir="$1"
|
local dir="$1"
|
||||||
|
@ -588,17 +575,19 @@ prepareImage() {
|
||||||
|
|
||||||
local iso="$1"
|
local iso="$1"
|
||||||
local dir="$2"
|
local dir="$2"
|
||||||
local missing
|
local desc missing
|
||||||
|
|
||||||
|
desc=$(printVersion "$DETECTED" "$DETECTED")
|
||||||
|
|
||||||
case "${DETECTED,,}" in
|
case "${DETECTED,,}" in
|
||||||
"win9"* | "win2k"* )
|
"win9"* | "win2k"* )
|
||||||
MACHINE="pc-i440fx-2.4" ;;
|
MACHINE="pc-i440fx-2.4" ;;
|
||||||
"winxp"* | "winvistax86"* | "win7x86"* )
|
"winvistax86"* | "win7x86"* | "winxp"* | "win2003"* )
|
||||||
MACHINE="pc-q35-2.10" ;;
|
MACHINE="pc-q35-2.10" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
case "${DETECTED,,}" in
|
case "${DETECTED,,}" in
|
||||||
"win9"* | "winxp"* | "win2k"* )
|
"win9"* | "win2k"* | "winxp"* | "win2003"* )
|
||||||
HV="N"
|
HV="N"
|
||||||
BOOT_MODE="windows_legacy" ;;
|
BOOT_MODE="windows_legacy" ;;
|
||||||
"winvista"* | "win7"* | "win2008"* )
|
"winvista"* | "win7"* | "win2008"* )
|
||||||
|
@ -606,18 +595,22 @@ prepareImage() {
|
||||||
esac
|
esac
|
||||||
|
|
||||||
case "${DETECTED,,}" in
|
case "${DETECTED,,}" in
|
||||||
"winxp"* )
|
|
||||||
DISK_TYPE="blk"
|
|
||||||
prepareXP "$iso" "$dir" && return 0
|
|
||||||
error "Failed to prepare Windows XP ISO!" && return 1 ;;
|
|
||||||
"win9"* )
|
"win9"* )
|
||||||
DISK_TYPE="auto"
|
DISK_TYPE="auto"
|
||||||
prepare9x "$iso" "$dir" && return 0
|
prepare9x "$iso" "$dir" "$desc" && return 0
|
||||||
error "Failed to prepare Windows 9x ISO!" && return 1 ;;
|
error "Failed to prepare $desc ISO!" && return 1 ;;
|
||||||
"win2k"* )
|
"win2k"* )
|
||||||
DISK_TYPE="auto"
|
DISK_TYPE="auto"
|
||||||
prepare2k "$iso" "$dir" && return 0
|
prepare2k "$iso" "$dir" "$desc" && return 0
|
||||||
error "Failed to prepare Windows 2000 ISO!" && return 1 ;;
|
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
|
esac
|
||||||
|
|
||||||
if [[ "${BOOT_MODE,,}" != "windows_legacy" ]]; then
|
if [[ "${BOOT_MODE,,}" != "windows_legacy" ]]; then
|
||||||
|
@ -627,13 +620,13 @@ prepareImage() {
|
||||||
missing=$(basename "$dir/$EFISYS")
|
missing=$(basename "$dir/$EFISYS")
|
||||||
[ ! -f "$dir/$ETFS" ] && missing=$(basename "$dir/$ETFS")
|
[ ! -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
|
return 1
|
||||||
fi
|
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
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -702,6 +695,7 @@ addDriver() {
|
||||||
"win81x64"* ) folder="w10/amd64" ;;
|
"win81x64"* ) folder="w10/amd64" ;;
|
||||||
"win10x64"* ) folder="w10/amd64" ;;
|
"win10x64"* ) folder="w10/amd64" ;;
|
||||||
"win11x64"* ) folder="w11/amd64" ;;
|
"win11x64"* ) folder="w11/amd64" ;;
|
||||||
|
"win2025"* ) folder="2k22/amd64" ;;
|
||||||
"win2022"* ) folder="2k22/amd64" ;;
|
"win2022"* ) folder="2k22/amd64" ;;
|
||||||
"win2019"* ) folder="2k19/amd64" ;;
|
"win2019"* ) folder="2k19/amd64" ;;
|
||||||
"win2016"* ) folder="2k16/amd64" ;;
|
"win2016"* ) folder="2k16/amd64" ;;
|
||||||
|
@ -933,6 +927,10 @@ buildImage() {
|
||||||
error "File $BOOT does already exist?!" && return 1
|
error "File $BOOT does already exist?!" && return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ ! -f "$dir/$ETFS" ]; then
|
||||||
|
error "Failed to locate file \"$ETFS\" in ISO image!" && return 1
|
||||||
|
fi
|
||||||
|
|
||||||
base=$(basename "$BOOT")
|
base=$(basename "$BOOT")
|
||||||
local out="$TMP/${base%.*}.tmp"
|
local out="$TMP/${base%.*}.tmp"
|
||||||
rm -f "$out"
|
rm -f "$out"
|
||||||
|
@ -961,7 +959,7 @@ buildImage() {
|
||||||
else
|
else
|
||||||
|
|
||||||
case "${DETECTED,,}" in
|
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 \
|
! 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" ;;
|
-relaxed-filenames -V "${LABEL::30}" -quiet "$dir" 2> "$log" && failed="y" ;;
|
||||||
"win9"* )
|
"win9"* )
|
||||||
|
|
Loading…
Reference in a new issue