#!/bin/sh # Flash a running camera over SSH: ./ota.sh parts/rtsp/app.bin [parts/rtsp/dtb.bin ...] # Uploads to /tmp (RAM), then fwupdate verifies + flashes + reboots. Keep file names # starting with app/dtb/kernel/rootfs/config/data so fwupdate knows the partition. set -e [ $# -ge 2 ] || { sed -n '2,4p' "$0"; exit 2; } IP=$1; shift REMOTE= for f in "$@"; do n=$(basename "$f") echo "upload $n ($(wc -c < "$f") bytes)" ssh root@"$IP" "cat > /tmp/$n" < "$f" l=$(md5sum < "$f" | cut -d' ' -f1); r=$(ssh root@"$IP" "md5sum /tmp/$n" | cut -d' ' -f1) [ "$l" = "$r" ] || { echo "md5 mismatch for $n"; exit 1; } REMOTE="$REMOTE /tmp/$n" done ssh root@"$IP" "fwupdate $REMOTE" || true echo "camera is rebooting (if all verified); wait ~40s then ssh back in"