Refactor Docker scripts to remove unnecessary installation of yq and use Python to check if the database path is set in the Frigate configuration file

This commit is contained in:
Sergey Krashevich 2023-07-29 05:55:40 +03:00
parent b42e995f0f
commit 2e3d73c220
No known key found for this signature in database
GPG Key ID: 625171324E7D3856
2 changed files with 3 additions and 9 deletions

View File

@ -77,9 +77,3 @@ apt-get purge gnupg apt-transport-https xz-utils -y
apt-get clean autoclean -y
apt-get autoremove --purge -y
rm -rf /var/lib/apt/lists/*
# Install yq, for frigate-prepare and go2rtc echo source
curl -fsSL \
"https://github.com/mikefarah/yq/releases/download/v4.33.3/yq_linux_$(dpkg --print-architecture)" \
--output /usr/local/bin/yq
chmod +x /usr/local/bin/yq

View File

@ -21,9 +21,9 @@ function migrate_db_path() {
fi
unset config_file_yaml
# Use yq to check if database.path is set
# check if database.path is set
local user_db_path
user_db_path=$(yq eval '.database.path' "${config_file}")
user_db_path=$(python3 -c "import yaml, json; data = json.loads(json.dumps(yaml.safe_load(open('${config_file}')))); print(data['database']['path']) if 'database' in data and 'path' in data['database'] else print('null')")
if [[ "${user_db_path}" == "null" ]]; then
local previous_db_path="/media/frigate/frigate.db"