#!/usr/bin/env bash
# ===========================================================================
# Paper Atlas 1.5 - Ubuntu / Linux / macOS one-click launcher
#
# ./start.sh start the dashboard
# ./start.sh --check print an environment report
# ./start.sh --port 9000 override the port for this run
#
# Everything (private Python, virtual environment, dependencies) is installed
# inside this folder, so no sudo and no system Python changes are required.
# ===========================================================================
set -uo pipefail
cd "$(dirname "$0")"
# Prefer the newest interpreter available (the launcher validates the version).
PY=""
for candidate in python3.13 python3.12 python3.11 python3.10 python3 python; do
if command -v "$candidate" >/dev/null 2>&1; then
PY="$candidate"
break
fi
done
if [ -z "$PY" ]; then
echo
echo " [!] No Python 3 found. Install it with:"
echo " sudo apt update && sudo apt install -y python3 python3-venv"
echo " Note: Ubuntu 20.04 ships Python 3.8, which is too old for 1.1."
echo " The launcher can bootstrap a newer one, but it needs a python3 to start;"
echo " install python3 first, then run ./start.sh again."
echo
exit 1
fi
exec "$PY" launcher.py "$@"