Skip to content

NVR with realtime local object detection for IP cameras

Allow to override go2rtc binary in add-on (#5876)

Felipe Santos1b8cd10142b6
diff --git a/docker/rootfs/etc/s6-overlay/s6-rc.d/go2rtc/run b/docker/rootfs/etc/s6-overlay/s6-rc.d/go2rtc/run
index 1f46194a31..be2e434913 100755
--- a/docker/rootfs/etc/s6-overlay/s6-rc.d/go2rtc/run
+++ b/docker/rootfs/etc/s6-overlay/s6-rc.d/go2rtc/run
@@ -54,8 +54,17 @@ if [[ ! -f "/dev/shm/go2rtc.yaml" ]]; then
python3 /usr/local/go2rtc/create_config.py
fi
+readonly config_path="/config"
+
+if [[ -x "${config_path}/go2rtc" ]]; then
+ readonly binary_path="${config_path}/go2rtc"
+ echo "[WARN] Using go2rtc binary from '${binary_path}' instead of the embedded one" >&2
+else
+ readonly binary_path="/usr/local/go2rtc/bin/go2rtc"
+fi
+
echo "[INFO] Starting go2rtc..."
# Replace the bash process with the go2rtc process, redirecting stderr to stdout
exec 2>&1
-exec go2rtc -config=/dev/shm/go2rtc.yaml
+exec "${binary_path}" -config=/dev/shm/go2rtc.yaml