#!/bin/bash # --- Production firmware update (Pi at onefinity.local) --- # # Builds a full firmware package (.tar.bz2) and PUTs it through the Pi's # /api/firmware/update endpoint. This is the canonical OTA flow and goes # through the bbctrl Tornado server's update handler. # # Defaults: # HOST=onefinity.local # PASSWORD=onefinity # # Override: # HOST=10.1.10.55 PASSWORD=secret ./deploy.sh prod set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" cd "$SCRIPT_DIR" HOST="${HOST:-onefinity.local}" PASSWORD="${PASSWORD:-onefinity}" # Require a clean working tree. echo "🔍 Checking git state..." if ! git diff --quiet || ! git diff --cached --quiet \ || [[ -n "$(git ls-files --others --exclude-standard)" ]]; then echo "❌ Refusing to deploy: working tree has uncommitted changes." git status --short exit 1 fi echo "✅ Working tree is clean." echo "🛠 Building firmware package..." make pkg echo "🚚 Uploading to http://${HOST}/api/firmware/update..." make update HOST="$HOST" PASSWORD="$PASSWORD" echo "" echo "✅ Firmware update PUT to ${HOST}." echo " The Pi will reboot itself after applying the update." echo " Once it comes back, open: http://${HOST}/"