#!/bin/bash # adacam-api installer for Hivemapper Bee device set -e INSTALL_DIR="/opt/adacam" DATA_DIR="/data/adacam" echo "[*] Installing adacam-api..." # Create directories mkdir -p "$INSTALL_DIR" "$DATA_DIR" # Copy files cp -r adacam_api main.py requirements.txt "$INSTALL_DIR/" # Install Python dependencies pip3 install --no-cache-dir -r "$INSTALL_DIR/requirements.txt" # Install systemd service cp systemd/adacam-api.service /etc/systemd/system/ systemctl daemon-reload systemctl enable adacam-api # Note: Config is generated by liberate.sh or on first API start # We don't validate Python imports here as the working directory matters if [ ! -f "$DATA_DIR/config.json" ]; then echo "[*] Config will be generated on first API start" fi echo "[*] Starting adacam-api..." systemctl restart adacam-api systemctl status adacam-api --no-pager || true echo "[+] Installation complete. API running on port 5000"