Refactor get_alma()

This commit is contained in:
Martin Wimpress 2022-02-21 01:51:49 +00:00
parent 15bb82501c
commit bbdd66d7d1
No known key found for this signature in database
GPG Key ID: 61DF940515E06DA3
1 changed files with 5 additions and 10 deletions

View File

@ -751,25 +751,20 @@ function get_android() {
function get_alma() {
local HASH=""
local ISO=""
local ISOTYPE="minimal"
local URL=""
local VERSION=""
#local isotype=""
validate_release "releases_alma"
ISOTYPE="minimal" # boot is a step too far for now - needs setting install source to mirror tree ... nope
if [ -n "${1}" ]; then
ISOTYPE="${1}"
fi
# The mirror url returns 10 or so local mirrors with some kind or RR rotation/load balancing
# We'll just grab the first
URL=$(wget -qq -O- "https://mirrors.almalinux.org/isos/x86_64/${RELEASE}.html" | awk -F"<li>|</li>" '{for(i=2;i<=NF;i+=2) {print $i}}' RS="" |grep href|cut -d\" -f2|head -1)
#VM_PATH="${VM_PATH}"-${ISOTYPE}
ISO=AlmaLinux-${RELEASE}-x86_64-${ISOTYPE}.iso
HASH="$(wget -q -O- "${URL}/CHECKSUM" | grep \(${ISO} | cut -d\ -f4)"
URL=$(wget -qq -O- "https://mirrors.almalinux.org/isos/x86_64/${RELEASE}.html" | awk -F"<li>|</li>" '{for(i=2;i<=NF;i+=2) {print $i}}' RS="" | grep href | cut -d'"' -f2 | head -1)
ISO="AlmaLinux-${RELEASE}-x86_64-${ISOTYPE}.iso"
HASH="$(wget -q -O- "${URL}/CHECKSUM" | grep \("${ISO}" | cut -d'\' -f4)"
web_get "${URL}/${ISO}" "${VM_PATH}"
check_hash "${ISO}" "${HASH}"
make_vm_config "${ISO}"
@ -1910,7 +1905,7 @@ if [ -n "${2}" ]; then
if [ "${OS}" == "alma" ]; then
if [ -n "${3}" ]; then
ISOTYPE="${3,,}"
ISOTYPES=(minimal dvd ) # boot) # a step too far
ISOTYPES=(minimal dvd)
if [[ ! ${ISOTYPES[*]} =~ ${ISOTYPE} ]]; then
echo "iso ${ISOTYPE} is not supported:"
for ISOTYPE in "${ISOTYPES[@]}"; do