#!/usr/bin/env bash set -euo pipefail slug='finops-04-gcp-budget-label' 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='f2562e705578bd703183d9014488d7b1001b412ad53fe03ea63bef3b52b84c61' 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."