#!/usr/bin/env bash set -euo pipefail slug='cloudops-02-azure-terraform-import' if [ -e "labs/$slug" ]; then echo "labs/$slug already exists; refusing to overwrite." >&2; exit 1; fi tmp=$(mktemp) map=$(mktemp) trap 'rm -f "$tmp" "$map"' EXIT curl -fsSL "https://devops.download/labs/$slug.tar.gz" -o "$tmp" expected='15006fcb59418cd07c90e282dbb4ce0fa40ac5b7222ac3886e50aba9dd19e07f' if command -v sha256sum >/dev/null; then actual=$(sha256sum "$tmp" | awk '{print $1}') elif command -v shasum >/dev/null; then actual=$(shasum -a 256 "$tmp" | awk '{print $1}') else echo "sha256sum or shasum is required." >&2; exit 1; fi if [ "$actual" != "$expected" ]; then echo "Archive checksum mismatch; nothing extracted." >&2; exit 1; fi tar -xOzf "$tmp" opsbreakfix-links.json > "$map" if [ -e opsbreakfix-links.json ] && ! cmp -s "$map" opsbreakfix-links.json; then echo "opsbreakfix-links.json differs from the bundle; refusing to overwrite." >&2; exit 1 fi tar -xzf "$tmp" echo "Installed. Next: cd labs/$slug and follow its lab page setup instructions."