OPNsense: dynamic crawl latest stable FreeBSD (#9831)

* fixed curl flag typo, updated FreeBSD from 14.2 to 14.3 (14.2 no longer available), ran test install to verify script runs as intended

* implemented latest version query for FreeBSD (ensuring only generic qcow2)

---------

Co-authored-by: CanbiZ <47820557+MickLesk@users.noreply.github.com>
This commit is contained in:
Austin Smith 2025-12-15 09:10:29 -07:00 committed by GitHub
parent 126b0c339a
commit 5ba55d1f5a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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.3-RELEASE/amd64/Latest/FreeBSD-14.3-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"