frigate: write the config in one place

Only the detector and model section depends on the CPU check, but the
file was assembled in three heredocs writing to the same path. That
shape is what produced the safe-mode config: both branches used a plain
redirect and discarded everything above them.

Pick the variable part into DETECTOR_CONFIG first and write the file
once, so the layout is visible in one block and no branch can replace
what came before it.

Output is unchanged, verified by generating both branches from the
previous commit and from this one and diffing: byte-identical.
This commit is contained in:
MickLesk
2026-09-15 10:51:42 +02:00
parent 4c8411fc5e
commit 1d09b2b4bf

View File

@@ -269,6 +269,23 @@ GLOG_minloglevel=3
GLOG_logtostderr=0
EOF
if grep -q -o -m1 -E 'avx[^ ]*|sse4_2' /proc/cpuinfo && [[ -f /openvino-model/ssdlite_mobilenet_v2.xml ]] && [[ -f /openvino-model/coco_91cl_bkgr.txt ]]; then
DETECTOR_CONFIG="detectors:
detector01:
type: openvino
device: AUTO
model:
width: 300
height: 300
input_tensor: nhwc
input_pixel_format: bgr
path: /openvino-model/ssdlite_mobilenet_v2.xml
labelmap_path: /openvino-model/coco_91cl_bkgr.txt"
else
DETECTOR_CONFIG="model:
path: /models/cpu_model.tflite"
fi
cat <<EOF >/config/config.yml
mqtt:
enabled: false
@@ -290,28 +307,8 @@ detect:
enabled: false
ffmpeg:
hwaccel_args: auto
${DETECTOR_CONFIG}
EOF
if grep -q -o -m1 -E 'avx[^ ]*|sse4_2' /proc/cpuinfo && [[ -f /openvino-model/ssdlite_mobilenet_v2.xml ]] && [[ -f /openvino-model/coco_91cl_bkgr.txt ]]; then
cat <<EOF >>/config/config.yml
detectors:
detector01:
type: openvino
device: AUTO
model:
width: 300
height: 300
input_tensor: nhwc
input_pixel_format: bgr
path: /openvino-model/ssdlite_mobilenet_v2.xml
labelmap_path: /openvino-model/coco_91cl_bkgr.txt
EOF
else
cat <<EOF >>/config/config.yml
model:
path: /models/cpu_model.tflite
EOF
fi
msg_ok "Configured Frigate"
msg_info "Creating Services"