Default the install prompts to yes

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
GuofangandClaude Sonnet 5.5 committed 2026-11-08 23:36:15 +08:00
1 parent 3935e2d5e2
commit 6064bd650d
2 files changed
+5 -5

No files matched your search

+2 -2
View File
@@ -126,9 +126,9 @@ fi
if [[ -z "${WIN11_VM_INSTALL_ISO:-}" ]] && ! "$downloader" --print-path windows11 --iso >/dev/null 2>&1; then
"$downloader" --print-path windows11 --iso >&2 || true
if { : </dev/tty >/dev/tty; } 2>/dev/null; then
printf 'Download the Windows 11 ISO now? [y/N] ' >/dev/tty
printf 'Download the Windows 11 ISO now? [Y/n] ' >/dev/tty
read -r answer </dev/tty || answer=
[[ "$answer" == [yY] || "$answer" == [yY][eE][sS] ]] || exit 1
[[ -z "$answer" || "$answer" == [yY] || "$answer" == [yY][eE][sS] ]] || exit 1
"$downloader" windows11 || exit 1
fi
fi
+3 -3
View File
@@ -157,13 +157,13 @@ EOF
}
# Ask a yes/no question on the terminal; fails when there is none or the answer
# is not yes. stdout carries the printed path, so all dialogue goes to /dev/tty.
# is not yes (an empty answer means yes). stdout carries the printed path, so all dialogue goes to /dev/tty.
ask_yes_no() {
local answer
{ : </dev/tty >/dev/tty; } 2>/dev/null || return 1
printf '%s [y/N] ' "$1" >/dev/tty
printf '%s [Y/n] ' "$1" >/dev/tty
read -r answer </dev/tty || return 1
[[ "$answer" == [yY] || "$answer" == [yY][eE][sS] ]]
[[ -z "$answer" || "$answer" == [yY] || "$answer" == [yY][eE][sS] ]]
}
# Print the base QCOW2 path. When the image does not exist and a terminal is