ba-auto-daily/setup.sh
Nik Afiq ebce31156b Refactor project structure and add setup script
- Transitioned the project to a Python-first architecture, moving feature logic from Bash to Python.
- Created a new `setup.sh` script to bootstrap the environment on `nik-gpu`, ensuring necessary tools are installed and setting up a Python virtual environment.
- Updated project layout in `plan.md` to reflect the new structure and clarify the purpose of each component.
- Established a reference mapping table for feature implementation based on the existing reference project.
- Outlined a migration phase to transition existing Bash functionality to Python tasks.
2026-07-05 15:24:45 +09:00

49 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
# Bootstrap a fresh clone of this repo so ba_dailies.sh can actually run.
#
# Run this ON nik-gpu, from the repo root (e.g. after `git clone` there) --
# not from macOS, since it installs into nik-gpu-local paths.
#
# It does NOT touch the game or take any screenshots; it only installs the
# venv and copies files to the fixed paths ba_dailies.sh/detect_and_click.py
# expect (outside the repo, per the two-machine deploy convention in
# CLAUDE.md).
set -e
VENV_DIR="$HOME/.venvs/ba-auto-daily"
SCRIPTS_DIR="$HOME/ba_scripts"
ASSETS_DIR="$HOME/ba_assets"
echo "== Checking host tools =="
missing=0
for cmd in xdotool scrot; do
if ! command -v "$cmd" >/dev/null 2>&1; then
echo "MISSING: $cmd (install with your package manager, e.g. sudo apt install $cmd)"
missing=1
fi
done
if [ "$missing" = 1 ]; then
echo "Install the missing tool(s) above, then re-run this script."
exit 1
fi
echo "xdotool, scrot: OK"
echo "== Setting up Python venv at $VENV_DIR =="
if [ ! -x "$VENV_DIR/bin/python3" ]; then
python3 -m venv "$VENV_DIR"
fi
"$VENV_DIR/bin/pip" install --quiet --upgrade pip
"$VENV_DIR/bin/pip" install --quiet opencv-python-headless numpy
"$VENV_DIR/bin/python3" -c "import cv2, numpy; print('opencv', cv2.__version__, '/ numpy', numpy.__version__)"
echo "== Deploying scripts + assets to fixed paths =="
mkdir -p "$SCRIPTS_DIR" "$ASSETS_DIR"
cp scripts/detect_and_click.py "$SCRIPTS_DIR/detect_and_click.py"
cp assets/cafe_sparkle.png "$ASSETS_DIR/cafe_sparkle.png"
cp ba_dailies.sh "$HOME/ba_dailies.sh"
chmod +x "$HOME/ba_dailies.sh"
echo "== Done =="
echo "Run with: ~/ba_dailies.sh [mailbox|cafe]"
echo "(requires the game already running, window titled 'BlueArchive')"