Comment remove function refactor due to lack of bash

pull/3/head
riley 1 year ago
parent c74c1b7302
commit 224ca2fd3e

@ -263,18 +263,16 @@ overwrite_warning_comment() {
}
remove_warning_comments() {
local name=$1
# Attribute list to remove warning comments
local attributes=(
"ffmpeg.inputs[0].path"
"ffmpeg.inputs[0].roles"
"record.enabled"
"snapshots.enabled"
"motion.mask"
)
for attribute in "${attributes[@]}"; do
yq '.cameras.'$name'.'$attribute' line_comment=""' -i /opt/docker2/compose/frigate/config.yml
done
yq '.cameras.'$name'.ffmpeg.inputs[0].path line_comment=""' -i /opt/docker2/compose/frigate/config.yml
yq '.cameras.'$name'.ffmpeg.inputs[0].roles line_comment=""' -i /opt/docker2/compose/frigate/config.yml
yq '.cameras.'$name'.record.enabled line_comment=""' -i /opt/docker2/compose/frigate/config.yml
yq '.cameras.'$name'.snapshots.enabled line_comment=""' -i /opt/docker2/compose/frigate/config.yml
yq '.cameras.'$name'.motion.mask line_comment=""' -i /opt/docker2/compose/frigate/config.yml
}
@ -344,7 +342,7 @@ sync_camera_config() {
fi
else
echo "Skipping camera $camera_name, overwrite is set to false."
remove_warning_comment $camera_name
remove_warning_comments $camera_name
fi
# Add to uci_cameras

Loading…
Cancel
Save