#!/usr/bin/env bash set -euo pipefail slug='mlops-04-preprocessing-data-leak' 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='fb8d0856cd57a0f29c550a6336a9c40b9386886d0f005f0d976d58bac1e3695f' 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."