Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/define.sh
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ printVersion() {

if [ -z "$desc" ]; then
desc="Windows"
[[ "${PLATFORM,,}" != "x64" ]] && desc+=" for ${PLATFORM}"
isPlatform "x64" || desc+=" for ${PLATFORM}"
fi

echo "$desc"
Expand Down
2 changes: 1 addition & 1 deletion src/image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1644,7 +1644,7 @@ extractESD() {
fKill "progress.sh"
html "$msg..."

if [[ "${PLATFORM,,}" == "x64" ]]; then
if isPlatform "x64"; then
LABEL="CCCOMA_X64FRE_EN-US_DV9"
else
LABEL="CPBA_A64FRE_EN-US_DV9"
Expand Down
25 changes: 15 additions & 10 deletions src/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ startInstall() {

if ! isCustomImage; then

if [ -s "$BOOT" ]; then
if hasImage "$BOOT"; then
ISO="$TMP/$(basename "$BOOT")"
else
ISO="$TMP/$file"
Expand All @@ -397,7 +397,7 @@ startInstall() {

# Keep existing media at its persistent path until all storage cleanup has
# completed successfully, so a later failure cannot strand it under $TMP.
if isCustomImage || [ ! -s "$BOOT" ]; then
if isCustomImage || ! hasImage "$BOOT"; then
if ! rm -f -- "$BOOT"; then
error "Failed to remove obsolete ISO file \"$BOOT\" !"
return 50
Expand Down Expand Up @@ -426,7 +426,7 @@ startInstall() {

# Work from the temporary directory so the persistent source path can
# later contain either the preserved ISO or the rebuilt installation image.
if ! isCustomImage && [ -f "$BOOT" ] && [ -s "$BOOT" ]; then
if ! isCustomImage && hasImage "$BOOT"; then
if ! mv -f -- "$BOOT" "$ISO"; then
error "Failed to move ISO file from \"$BOOT\" to \"$ISO\" !"
return 50
Expand Down Expand Up @@ -454,7 +454,7 @@ skipUnattended() {

# When automatic preparation fails, inspect extracted media to determine
# whether it can still be booted manually using legacy firmware.
if enabled "$aborted" && [[ "${PLATFORM,,}" == "x64" ]] && [ -d "$dir" ]; then
if enabled "$aborted" && isPlatform "x64" && [ -d "$dir" ]; then

efi=$(find "$dir" -maxdepth 1 -type d -iname efi -print -quit) || return 1
efi32=$(find "$dir" -maxdepth 3 -type f -ipath '*/efi/boot/bootia32.efi' -print -quit) || return 1
Expand Down Expand Up @@ -581,7 +581,7 @@ finishInstall() {

local base secure=0

if [ ! -s "$iso" ] || [ ! -f "$iso" ]; then
if ! hasImage "$iso"; then
error "Failed to find ISO file: $iso" && return 1
fi

Expand Down Expand Up @@ -613,7 +613,7 @@ finishInstall() {
fi
fi

if [[ "${PLATFORM,,}" == "x64" ]]; then
if isPlatform "x64"; then
if isLegacyBoot; then

writeState "mode" "$BOOT_MODE" || {
Expand Down Expand Up @@ -710,7 +710,7 @@ findFile() {
file="$STORAGE/$base"
fi

if [ ! -f "$file" ] || [ ! -s "$file" ]; then
if ! hasImage "$file"; then
return 0
fi

Expand Down Expand Up @@ -777,11 +777,16 @@ isURL() {
[[ "${value,,}" == "http"* ]]
}

isLegacyBoot() {
isPlatform() {

local platform="$1"

local mode="${BOOT_MODE:-}"
[[ "${PLATFORM,,}" == "${platform,,}" ]]
}

isLegacyBoot() {

[[ "${mode,,}" == "windows_legacy" ]]
[[ "${BOOT_MODE,,}" == "windows_legacy" ]]
}

hasBootMarker() {
Expand Down
6 changes: 3 additions & 3 deletions src/legacy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ setMachine() {

esac

if [[ "${id,,}" == "reactos" ]] && [ -z "$CUSTOM" ]; then
if [[ "${id,,}" == "reactos" ]] && ! isCustomImage; then
# The ISO is a Live-CD so we need to disable the data disk
# as it will be always wiped during the next runs currently.
DISK_DISABLE="Y"
Expand Down Expand Up @@ -115,7 +115,7 @@ restoreMachine() {
# Restore the saved machine only when q35 is still the default;
# an explicit user-selected machine must remain untouched.
[[ "${MACHINE,,}" != "q35" ]] && return 0
[[ "${PLATFORM,,}" != "x64" ]] && return 0
isPlatform "x64" || return 0

MACHINE=""
restoreState "MACHINE" "old" || return 1
Expand Down Expand Up @@ -1016,7 +1016,7 @@ detectLegacy() {
local dir="$1"
local marker

[[ "${PLATFORM,,}" == "x64" ]] || return 1
isPlatform "x64" || return 1

# Legacy media is identified from setup marker files rather than WIM
# metadata. The order is intentional because several releases share markers.
Expand Down
4 changes: 2 additions & 2 deletions src/mido.sh
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ downloadWindowsEval() {
type="iot"
winVer="windows-11-iot-enterprise-ltsc-eval" ;;
"win11${PLATFORM,,}-enterprise-ltsc-eval" )
if [[ "${PLATFORM,,}" == "arm64" ]]; then
if isPlatform "arm64"; then
type="iot"
winVer="windows-11-iot-enterprise-ltsc-eval"
else
Expand Down Expand Up @@ -595,7 +595,7 @@ getWindows() {
"win11${PLATFORM,,}-enterprise"* ) ;;
* )

if [[ "${PLATFORM,,}" != "x64" ]]; then
if ! isPlatform "x64"; then
error "No download for the ${PLATFORM^^} platform available for $edition!"
MIDO_URL=""
return 1
Expand Down
4 changes: 2 additions & 2 deletions src/power.sh
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ sendKey() {

needsBootKey() {

[ ! -s "$BOOT" ] && return 1
hasImage "$BOOT" || return 1

hasCompletedInstall && return 1
supportsBootKey "$DETECTED" || return 1
Expand All @@ -363,7 +363,7 @@ bootKeyReady() {
return $?
fi

if [[ "${PLATFORM,,}" == "arm64" ]]; then
if isPlatform "arm64"; then
grep -Eq "$UEFI_USB_BOOT_PATTERN" "$QEMU_PTY"
else
grep -Eq "$UEFI_DVD_BOOT_PATTERN" "$QEMU_PTY"
Expand Down