From 06aad91f02b9fe30f1a05f478230c08871370049 Mon Sep 17 00:00:00 2001 From: Twarner491 Date: Sun, 21 Jun 2026 18:39:55 -0700 Subject: [PATCH] [FIX] installer: serve the AvianVisitors collage at / on a fresh clone --- scripts/install_services.sh | 7 +++++++ scripts/update_caddyfile.sh | 10 +++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/scripts/install_services.sh b/scripts/install_services.sh index 882cd91..1c079d3 100755 --- a/scripts/install_services.sh +++ b/scripts/install_services.sh @@ -238,6 +238,13 @@ EOF usermod -aG $USER caddy usermod -aG video caddy chmod g+r+x $HOME + + # Serve the AvianVisitors collage at / rather than the stock BirdNET-Pi UI. + # The Caddyfile written above is the stock one (hardcoded php-fpm.sock, no + # index.html try_files override); re-apply both through update_caddyfile.sh, + # the single source of truth, so / serves index.html not index.php. Run it + # last so it wins. + "$HOME/BirdNET-Pi/scripts/update_caddyfile.sh" } install_avahi_aliases() { diff --git a/scripts/update_caddyfile.sh b/scripts/update_caddyfile.sh index 4c4cc1e..142fbbf 100755 --- a/scripts/update_caddyfile.sh +++ b/scripts/update_caddyfile.sh @@ -84,4 +84,12 @@ EOF fi sudo caddy fmt --overwrite /etc/caddy/Caddyfile -sudo systemctl reload caddy +# Fail loudly on a Caddyfile caddy can't parse rather than reloading a broken +# config and reporting success. +sudo caddy validate --config /etc/caddy/Caddyfile --adapter caddyfile || { + echo "generated Caddyfile failed validation; not reloading caddy" >&2 + exit 1 +} +# reload-or-restart so this also works at install time, when caddy may not be +# running yet (a plain reload would fail there); tolerate a not-yet-ready unit. +sudo systemctl reload-or-restart caddy 2>/dev/null || true