Add hash checking for FreeBSD

This commit is contained in:
Martin Wimpress 2021-10-21 01:13:43 +01:00
parent cae95e5b14
commit 271f3472af
No known key found for this signature in database
GPG Key ID: 61DF940515E06DA3

View File

@ -427,6 +427,7 @@ function check_hash() {
32) hash_algo=md5sum;; 32) hash_algo=md5sum;;
40) hash_algo=sha1sum;; 40) hash_algo=sha1sum;;
64) hash_algo=sha256sum;; 64) hash_algo=sha256sum;;
128) hash_algo=sha512sum;;
*) echo "WARNING! Can't guess hash algorithm, not checking ${iso} hash." *) echo "WARNING! Can't guess hash algorithm, not checking ${iso} hash."
return;; return;;
esac esac
@ -574,13 +575,17 @@ function get_elementary() {
} }
function get_freebsd() { function get_freebsd() {
local HASH=""
local ISO="" local ISO=""
local URL="" local URL=""
validate_release "releases_freebsd" validate_release "releases_freebsd"
ISO="FreeBSD-${RELEASE}-RELEASE-amd64-dvd1.iso" ISO="FreeBSD-${RELEASE}-RELEASE-amd64-dvd1.iso"
HASH=$(wget -q -O- "https://download.freebsd.org/ftp/releases/amd64/amd64/ISO-IMAGES/${RELEASE}/CHECKSUM.SHA512-FreeBSD-${RELEASE}-RELEASE-amd64" | grep '('"${ISO}"')' | cut -d' ' -f4)
echo "${HASH}"
URL="https://download.freebsd.org/ftp/releases/amd64/amd64/ISO-IMAGES/${RELEASE}/${ISO}" URL="https://download.freebsd.org/ftp/releases/amd64/amd64/ISO-IMAGES/${RELEASE}/${ISO}"
web_get "${URL}" "${VM_PATH}" web_get "${URL}" "${VM_PATH}"
check_hash "${ISO}" "${HASH}"
make_vm_config "${ISO}" make_vm_config "${ISO}"
} }