#!/usr/bin/env bash set -euo pipefail # Navigate to setup-network/ regardless of where we're called from SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" cd "$SCRIPT_DIR" # Activate virtualenv if present, otherwise require pyinstaller in PATH if [[ -f .venv/bin/activate ]]; then source .venv/bin/activate echo "Activated .venv" elif ! command -v pyinstaller &>/dev/null; then echo "Error: pyinstaller not found. Either create a .venv or install pyinstaller." >&2 echo " python3 -m venv .venv && .venv/bin/pip install -r requirements.txt" >&2 exit 1 fi DIST_DIR="${SCRIPT_DIR}/../dist" echo "Building setup-network binary..." pyinstaller --onefile --clean --name setup-network --distpath "$DIST_DIR" setup_network.py echo "Copying config.ini to dist/..." cp "${SCRIPT_DIR}/../config.ini" "$DIST_DIR/" echo "" echo "Build complete. Output:" echo " ${DIST_DIR}/setup-network" echo " ${DIST_DIR}/config.ini"