#!/bin/bash
# Punchy! one-click installer for Mac
cd "$(dirname "$0")" || exit 1

clear
echo ""
echo "  Punchy! installer"
echo "  starting up, one moment..."
echo ""

if ! command -v python3 >/dev/null 2>&1; then
  echo "  This Mac needs Python first."
  echo "  Type this in Terminal, accept the popup, then run me again:"
  echo ""
  echo "      xcode-select --install"
  echo ""
  read -r -p "  Press Enter to close "
  exit 1
fi

TMP="$(mktemp -t punchy)".py
if ! curl -fsSL "https://punchy-install.pages.dev/punchy-install.py" -o "$TMP"; then
  echo "  Could not download the installer. Check the internet and try again."
  read -r -p "  Press Enter to close "
  exit 1
fi

python3 "$TMP"
