From 9e919a55e9dbaec44c3adb7371f7aa33946b0cea Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Mon, 29 Apr 2024 17:27:42 +0200 Subject: [PATCH] Update 99-run.sh --- birdnet-pi/rootfs/etc/cont-init.d/99-run.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/birdnet-pi/rootfs/etc/cont-init.d/99-run.sh b/birdnet-pi/rootfs/etc/cont-init.d/99-run.sh index 77657b40e..8f2893154 100755 --- a/birdnet-pi/rootfs/etc/cont-init.d/99-run.sh +++ b/birdnet-pi/rootfs/etc/cont-init.d/99-run.sh @@ -21,6 +21,11 @@ grep -o '^[^#=]*=' "$configtemplate" | sed 's/=//' | while read -r var; do bashio::log.yellow "...$var was missing from your birdnet.conf file, it was re-added" grep "^$var=" "$configtemplate" >> "$configcurrent" fi + # Check for duplicates + if [ "$(grep -c "^$var=" "$configcurrent")" -gt 1 ]; then + bashio::log.error "Duplicate variable $var found in $configcurrent, all were commented out expect for the first one" + awk -v var="$var" '{ if ($0 ~ "^[[:blank:]]*"var && c++ > 0) print "#" $0; else print $0; }' "$configcurrent" > temp && mv temp "$configcurrent" + fi done ##############