c7ab02cc59
SNEK resets to authentication=enabled on every restart and does not persist the state anywhere. The entrypoint now waits for the SNEK API to be ready and POSTs to /ned/saturation to disable auth automatically. - Registered devices without HMAC public keys (e.g. demo Sens'it) are decoded immediately on first boot and after any pod restart - To re-enable auth in production, comment the polling block in entrypoint.sh README updated with details in the "Configuration des devices" section. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
39 lines
1.3 KiB
Bash
39 lines
1.3 KiB
Bash
#!/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
|