#!/bin/bash
# NexusOS installer, Linux. One painless command:
#
#   git clone <repo> nexus-core && cd nexus-core && ./install.sh
#
# ponytail: a wrapper, not an installer. Every step - git pull, venv, pip with
# the right GPU overlay, npm build, apt packages, Ollama binary, desktop wiring
# - lives in bin/sync.py, shared with native Windows. Duplicating any of it here
# means two installers drifting apart, which is exactly how the old
# bin/install.sh ended up rsyncing from a backup path retired months earlier.
# Re-run it any time to update; --check dry-runs it. Windows: install-windows.ps1.
set -euo pipefail
cd "$(dirname "$0")"

if ! command -v python3 >/dev/null; then
    echo "python3 is required (it runs the installer). Install it, then re-run:" >&2
    echo "  sudo apt-get install -y python3 python3-venv" >&2
    exit 1
fi

# Prefer the venv interpreter once it exists, same as ncp does; python3 is the
# bootstrap case on a fresh clone. sync.py is stdlib-only either way.
py=Promethean/bin/python
[ -x "$py" ] || py=python3

exec "$py" bin/sync.py restore "$@"
