mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-06 11:15:21 +03:00
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:
parent
b42e995f0f
commit
2e3d73c220
@ -76,10 +76,4 @@ fi
|
|||||||
apt-get purge gnupg apt-transport-https xz-utils -y
|
apt-get purge gnupg apt-transport-https xz-utils -y
|
||||||
apt-get clean autoclean -y
|
apt-get clean autoclean -y
|
||||||
apt-get autoremove --purge -y
|
apt-get autoremove --purge -y
|
||||||
rm -rf /var/lib/apt/lists/*
|
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
|
|
||||||
@ -21,9 +21,9 @@ function migrate_db_path() {
|
|||||||
fi
|
fi
|
||||||
unset config_file_yaml
|
unset config_file_yaml
|
||||||
|
|
||||||
# Use yq to check if database.path is set
|
# check if database.path is set
|
||||||
local user_db_path
|
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
|
if [[ "${user_db_path}" == "null" ]]; then
|
||||||
local previous_db_path="/media/frigate/frigate.db"
|
local previous_db_path="/media/frigate/frigate.db"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user