blakeblackshear.frigate/docker/main/rootfs/etc/s6-overlay/s6-rc.d/frigate/run
Nicolas Mowen dc44a6c3b4
Community Supported Boards Framework (#7114)
* Make main frigate build non rpi specific and build rpi using base image

* Add boards to sidebar

* Fix docker build

* Fix docs build

* Update pr branch for testing

* remove target from rpi build

* Remove manual build

* Add push build for rpi

* fix typos, improve wording

* Add arm build for rpi

* Cleanup and add default github ref name

* Cleanup docker build file system

* Setup to use docker bake

* Add ci/cd for bake

* Fix path

* Fix devcontainer

* Set targets

* Fix build

* Fix syntax

* Add wheels target

* Move dev container to trt

* Update key and fix rpi local

* Move requirements files and set intermediate targets

* Add back --load

* Update docs for community board development

* Update installation docs to reflect different builds available

* Update docs with official and community supported headers

* Update codeowners docs

* Update docs

* Assemble main and standard builds

* Change order of pushes

* Remove community board after successful build

* Fix rpi bake file names
2023-07-23 16:45:29 -05:00

56 lines
2.0 KiB
Plaintext
Executable File

#!/command/with-contenv bash
# shellcheck shell=bash
# Start the Frigate service
set -o errexit -o nounset -o pipefail
# Logs should be sent to stdout so that s6 can collect them
# Tell S6-Overlay not to restart this service
s6-svc -O .
function migrate_db_path() {
# Find config file in yaml or yml, but prefer yaml
local config_file="${CONFIG_FILE:-"/config/config.yml"}"
local config_file_yaml="${config_file//.yml/.yaml}"
if [[ -f "${config_file_yaml}" ]]; then
config_file="${config_file_yaml}"
elif [[ ! -f "${config_file}" ]]; then
echo "[ERROR] Frigate config file not found"
return 1
fi
unset config_file_yaml
# Use yq to check if database.path is set
local user_db_path
user_db_path=$(yq eval '.database.path' "${config_file}")
if [[ "${user_db_path}" == "null" ]]; then
local previous_db_path="/media/frigate/frigate.db"
local new_db_dir="/config"
if [[ -f "${previous_db_path}" ]]; then
if mountpoint --quiet "${new_db_dir}"; then
# /config is a mount point, move the db
echo "[INFO] Moving db from '${previous_db_path}' to the '${new_db_dir}' dir..."
# Move all files that starts with frigate.db to the new directory
mv -vf "${previous_db_path}"* "${new_db_dir}"
else
echo "[ERROR] Trying to migrate the db path from '${previous_db_path}' to the '${new_db_dir}' dir, but '${new_db_dir}' is not a mountpoint, please mount the '${new_db_dir}' dir"
return 1
fi
fi
fi
}
echo "[INFO] Preparing Frigate..."
migrate_db_path
export LIBAVFORMAT_VERSION_MAJOR=$(ffmpeg -version | grep -Po 'libavformat\W+\K\d+')
echo "[INFO] Starting Frigate..."
cd /opt/frigate || echo "[ERROR] Failed to change working directory to /opt/frigate"
# Replace the bash process with the Frigate process, redirecting stderr to stdout
exec 2>&1
exec python3 -u -m frigate