#!/usr/bin/env bash set -euo pipefail slug='devops-02-k8s-missing-endpoints' 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='481e8ceacfb98efe2e8a310bb61ca17bf94030027969de98bcae616ab2f9e2bd' 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 && ./setup.sh"