diff --git a/vm/opnsense-vm.sh b/vm/opnsense-vm.sh index bea6d676029..04f92df31c5 100644 --- a/vm/opnsense-vm.sh +++ b/vm/opnsense-vm.sh @@ -578,7 +578,25 @@ fi msg_ok "Using ${CL}${BL}$STORAGE${CL} ${GN}for Storage Location." msg_ok "Virtual Machine ID is ${CL}${BL}$VMID${CL}." msg_info "Retrieving the URL for the OPNsense Qcow2 Disk Image" -URL="https://download.freebsd.org/releases/VM-IMAGES/14.2-RELEASE/amd64/Latest/FreeBSD-14.2-RELEASE-amd64.qcow2.xz" +# Use latest stable FreeBSD amd64 qcow2 VM image (generic, not UFS/ZFS) +RELEASE_LIST="$(curl -s https://download.freebsd.org/releases/VM-IMAGES/ \ + | grep -Eo '[0-9]+\.[0-9]+-RELEASE' \ + | sort -Vr \ + | uniq)" +URL="" +FREEBSD_VER="" +for ver in $RELEASE_LIST; do + candidate="https://download.freebsd.org/releases/VM-IMAGES/${ver}/amd64/Latest/FreeBSD-${ver}-amd64.qcow2.xz" + if curl -fsI "$candidate" >/dev/null 2>&1; then + FREEBSD_VER="$ver" + URL="$candidate" + break + fi +done +if [ -z "$URL" ]; then + msg_error "Could not find generic FreeBSD amd64 qcow2 image (non-UFS/ZFS)." + exit 1 +fi msg_ok "Download URL: ${CL}${BL}${URL}${CL}" curl -f#SL -o "$(basename "$URL")" "$URL" echo -en "\e[1A\e[0K"