make go2rtc always rebuild config at startup (#8664)

* make go2rtc always rebuild config at startup

/dev/shm can be left mounted (in fact im pretty sure it's always left mounted) on the docker host after shutting down the frigate container.
If we only check that the file doesn't exist, stale data gets re-read every startup 
This will make troubleshooting a nightmare for the average user.

I had given up troubleshooting go2rtc several times because of this.

* generate config after supervisor data is loaded

* Fix fi

* fix fi

---------

Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>
This commit is contained in:
trademark789 2023-11-19 08:08:42 -05:00 committed by GitHub
parent fc186e4d5f
commit 934b16723b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -45,8 +45,12 @@ function get_ip_and_port_from_supervisor() {
export LIBAVFORMAT_VERSION_MAJOR=$(ffmpeg -version | grep -Po 'libavformat\W+\K\d+') export LIBAVFORMAT_VERSION_MAJOR=$(ffmpeg -version | grep -Po 'libavformat\W+\K\d+')
if [[ -f "/dev/shm/go2rtc.yaml" ]]; then
echo "[INFO] Removing stale config from last run..."
rm /dev/shm/go2rtc.yaml
if [[ ! -f "/dev/shm/go2rtc.yaml" ]]; then if [[ ! -f "/dev/shm/go2rtc.yaml" ]]; then
echo "[INFO] Preparing go2rtc config..." echo "[INFO] Preparing new go2rtc config..."
if [[ -n "${SUPERVISOR_TOKEN:-}" ]]; then if [[ -n "${SUPERVISOR_TOKEN:-}" ]]; then
# Running as a Home Assistant add-on, infer the IP address and port # Running as a Home Assistant add-on, infer the IP address and port
@ -54,6 +58,8 @@ if [[ ! -f "/dev/shm/go2rtc.yaml" ]]; then
fi fi
python3 /usr/local/go2rtc/create_config.py python3 /usr/local/go2rtc/create_config.py
else
echo "[WARNING] Unable to remove existing go2rtc config. Changes made to your frigate config file may not be recognized. Please remove the /dev/shm/go2rtc.yaml from your docker host manually."
fi fi
readonly config_path="/config" readonly config_path="/config"