Add an openssh-win target to download the Win32-OpenSSH zip

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
GuofangandClaude Sonnet 5.5 committed 2026-10-19 14:28:13 +08:00
1 parent f5881cd5c8
commit 5e58722aca
3 files changed
+27 -3

No files matched your search

+1
View File
@@ -4,6 +4,7 @@
*.img
*.vhd
*.vhdx
*.zip
*.part
*.part.url
*.aria2
+6 -1
View File
@@ -51,7 +51,8 @@ ISO (for example `Win11_25H2_English_x64_v2.iso` →
existing `*Win*11*x64*.qcow2` (`*Win*11*arm64*.qcow2` on arm64) in `base-qcow2/` is used instead.
Download URLs can be overridden with `DEBIAN_IMAGE_URL`, `ALMA_IMAGE_URL`,
`FEDORA_IMAGE_URL`, `UBUNTU_IMAGE_URL`, and `VIRTIO_WIN_ISO_URL`. Each may
`FEDORA_IMAGE_URL`, `UBUNTU_IMAGE_URL`, `VIRTIO_WIN_ISO_URL`, and
`OPENSSH_WIN_ZIP_URL`. Each may
list several mirrors of the same file, separated by whitespace; the Fedora
image defaults to the TUNA, BFSU and NJU mirrors, and the Ubuntu image to the
TUNA, NJU and official cloud-images.ubuntu.com mirrors.
@@ -63,6 +64,10 @@ download is only resumed with the same downloader and mirror list; otherwise
it starts over. The Fedora and Ubuntu checksums can be overridden with
`FEDORA_IMAGE_SHA256` and `UBUNTU_IMAGE_SHA256` when using a custom image.
The `openssh-win` target downloads the Win32-OpenSSH zip matching the
architecture into `tools-iso/`: `OpenSSH-Win64.zip` on amd64 hosts and
`OpenSSH-ARM64.zip` on arm64 hosts.
## Windows installation disk image
QEMU's emulated USB CD-ROM reads the Windows ISO at only a few MB/s on macOS.
+20 -2
View File
@@ -57,6 +57,15 @@ fi
virtio_image="${tools_iso_dir}/virtio-win.iso"
# Win32-OpenSSH names its zip after the architecture: Win64 for x64 and ARM64
# for arm64.
if [[ "$image_arch" == arm64 ]]; then
openssh_zip=OpenSSH-ARM64.zip
else
openssh_zip=OpenSSH-Win64.zip
fi
openssh_image="${tools_iso_dir}/${openssh_zip}"
# Windows 11 media is named after the architecture: x64 on amd64 hosts and
# Arm64 on arm64 hosts.
if [[ "$image_arch" == arm64 ]]; then
@@ -111,6 +120,7 @@ debian_url="${DEBIAN_IMAGE_URL:-$debian_url_default}"
alma_url="${ALMA_IMAGE_URL:-$alma_url_default}"
fedora_url="${FEDORA_IMAGE_URL:-$fedora_url_default}"
ubuntu_url="${UBUNTU_IMAGE_URL:-$ubuntu_url_default}"
openssh_url="${OPENSSH_WIN_ZIP_URL:-https://github.com/PowerShell/Win32-OpenSSH/releases/download/10.0.0.0p2-Preview/${openssh_zip}}"
virtio_url="${VIRTIO_WIN_ISO_URL:-https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso}"
debian_sha512="${DEBIAN_IMAGE_SHA512:-$debian_sha512_default}"
alma_sha256="${ALMA_IMAGE_SHA256:-$alma_sha256_default}"
@@ -120,7 +130,7 @@ force_download=false
usage() {
cat <<EOF
Usage: $(basename "$0") [--force] [all|debian13|almalinux10|fedora44|ubuntu2604|virtio-win] ...
Usage: $(basename "$0") [--force] [all|debian13|almalinux10|fedora44|ubuntu2604|virtio-win|openssh-win] ...
$(basename "$0") --print-path TARGET [--iso]
Download one or more shared VM images. With no arguments, all targets are
@@ -150,6 +160,7 @@ print_image_path() {
fedora44) printf '%s\n' "$fedora_image" ;;
ubuntu2604) printf '%s\n' "$ubuntu_image" ;;
virtio-win) printf '%s\n' "$virtio_image" ;;
openssh-win) printf '%s\n' "$openssh_image" ;;
windows11)
if [[ "$media" == iso ]]; then
windows_iso_path
@@ -195,7 +206,7 @@ fi
for target in "${targets[@]}"; do
case "$target" in
all|debian13|almalinux10|fedora44|ubuntu2604|virtio-win) ;;
all|debian13|almalinux10|fedora44|ubuntu2604|virtio-win|openssh-win) ;;
-h|--help) usage; exit 0 ;;
*) printf 'Error: unknown download target: %s\n' "$target" >&2; usage >&2; exit 2 ;;
esac
@@ -417,3 +428,10 @@ if wants_target virtio-win; then
"$virtio_url" \
"$virtio_image"
fi
if wants_target openssh-win; then
download_file \
'Win32-OpenSSH zip' \
"$openssh_url" \
"$openssh_image"
fi