1
0
Files
pve-lab/02-download-iso.sh
2026-08-02 10:40:47 -05:00

24 lines
754 B
Bash
Executable File

#!/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"