#!/bin/bash set -e echo "==> Sigfox Network Emulator container starting" echo "==> Detecting Sigfox dongle..." if lsusb | grep -iE "2cc1"; then echo "==> Dongle detected" else echo "!!! WARNING: no Sigfox dongle detected on /dev/bus/usb" echo "!!! Make sure the container has: privileged: true AND /dev/bus/usb mounted" fi echo "==> Flashing firmware (foxctl)..." cd /opt/snek ./foxctl || echo "foxctl RC=$? (may be normal if firmware already loaded)" sleep 2 # Auto-disable message authentication after SNEK is up # SNEK resets to auth=enabled on every restart; we disable it so registered # devices without a public key can still be decoded ( for i in $(seq 1 30); do if curl -sf http://localhost:8085/ned/saturation > /dev/null 2>&1; then echo "==> SNEK API ready, disabling message authentication..." curl -sX POST -H "Content-Type: application/json" \ -d '{"saturation":false,"authentication":false,"dongleDisconnected":false}' \ http://localhost:8085/ned/saturation > /dev/null echo "==> Message authentication disabled" exit 0 fi sleep 2 done echo "!!! Warning: SNEK API not reachable after 60s, auth not toggled" ) & echo "==> Starting SNEK main_sigfox on port 8085..." exec ./main_sigfox