#!/usr/bin/env bash # Download the Proxmox VE ISO into the libvirt pool dir and verify its sha256. set -euo pipefail source "$(dirname "$0")/lab.env" sudo -v # prompt for the sudo password once, up front DEST="${LIB_DIR}/${ISO_FILE}" verify() { echo "${ISO_SHA256} ${DEST}" | sudo sha256sum -c - >/dev/null 2>&1; } if sudo test -f "$DEST" && verify; then echo "==> ${ISO_FILE} already present and verified" else echo "==> Downloading ${ISO_URL}" sudo curl -fL --progress-bar -o "$DEST" "$ISO_URL" echo "==> Verifying sha256" verify || { echo "ERROR: checksum mismatch for $DEST"; exit 1; } echo " OK" fi command -v restorecon >/dev/null && sudo restorecon "$DEST" || true echo echo "ISO ready. Next: ./03-build-autoinstall-isos.sh"