#!/usr/bin/env bash set -euo pipefail slug='finops-03-gcp-budget-stop' 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='52f118449e297bc6897b650b020348bb8ae6c9c4f79262a72d3110bfb4b99cd3' 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."