#!/usr/bin/env bash # Upgrade camera-trng: pull latest, rebuild, and restart the LaunchAgent. # Usage: ./scripts/upgrade.sh set -e cd "$(dirname "$0")/.." ROOT="$(pwd)" PLIST="${HOME}/Library/LaunchAgents/camera-trng.plist" echo "=== Camera TRNG Upgrade ===" echo "Pulling latest..." git pull --ff-only origin master echo "Building release binary..." cargo build --release # Restart the LaunchAgent if installed if [[ -f "$PLIST" ]]; then echo "Restarting LaunchAgent..." launchctl unload "$PLIST" 2>/dev/null || true launchctl load "$PLIST" echo "LaunchAgent restarted with new binary." else echo "No LaunchAgent installed. Run ./scripts/install-launchagent.sh to set up auto-start." echo "Or start manually: ./scripts/run-mac.sh" fi echo "Done."