From 4395bf9e8d2a40a9e5bd594640f52f38dbbfa0a2 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Sat, 24 Oct 2026 21:29:11 +0300 Subject: [PATCH] fix(baikal): run the database upgrade at startup so DAV clients don't loop on redirects (#3149) * fix(baikal): run the database upgrade at startup so DAV clients don't loop on redirects (#3148) Baikal 0.13.0 redirects every request to its upgrade wizard until the configured version matches the shipped one; DAV clients follow that relative redirect into a loop. Trigger the wizard locally once nginx is up. Co-Authored-By: Claude Opus 5.5 * docs(baikal): recommend a backup before the automatic upgrade Co-Authored-By: Claude Opus 5.5 * fix(baikal): don't abort startup on fresh installs without baikal.yaml Co-Authored-By: Claude Opus 5.5 --------- Co-authored-by: Claude Opus 5.5 --- baikal/CHANGELOG.md | 3 +++ baikal/config.yaml | 2 +- baikal/rootfs/etc/cont-init.d/90-run.sh | 17 +++++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/baikal/CHANGELOG.md b/baikal/CHANGELOG.md index cf154e1ada..1d915674ea 100644 --- a/baikal/CHANGELOG.md +++ b/baikal/CHANGELOG.md @@ -1,4 +1,7 @@ +## 0.13.0.1 (24-10-2026) +- Fix DAV clients failing with "Too many redirects" after the update to 0.13.0 (#3148) : the add-on now runs the Baikal database upgrade itself at startup, instead of waiting for it to be confirmed in the web admin. As upstream recommends for 0.13.0, keep a backup of the add-on before updating + ## 0.13.0 (2026-10-24) - Update to latest version from sabre-io/Baikal (changelog : https://github.com/sabre-io/Baikal/releases) - Migrate legacy add-on configuration map names to current app configuration terminology. diff --git a/baikal/config.yaml b/baikal/config.yaml index c015c4378a..96dabb9f94 100644 --- a/baikal/config.yaml +++ b/baikal/config.yaml @@ -84,5 +84,5 @@ schema: slug: baikal udev: true url: https://github.com/alexbelgium/hassio-addons -version: "0.13.0" +version: "0.13.0.1" webui: "[PROTO:ssl]://[HOST]:[PORT:80]" diff --git a/baikal/rootfs/etc/cont-init.d/90-run.sh b/baikal/rootfs/etc/cont-init.d/90-run.sh index 6f6bdada89..b5a7b10ab8 100755 --- a/baikal/rootfs/etc/cont-init.d/90-run.sh +++ b/baikal/rootfs/etc/cont-init.d/90-run.sh @@ -20,6 +20,23 @@ done # Fix permissions chown -R nginx:nginx /data +# After a version update Baikal redirects every request to its upgrade wizard +# until the database is upgraded, and DAV clients loop on that redirect (#3148). +# Run the wizard once nginx answers, as confirming it in the web admin would +configured="$(sed -n "s/^ *configured_version: *['\"]\?\([^'\"]*\).*/\1/p" /data/config/baikal.yaml 2>/dev/null || true)" +shipped="$(sed -n 's/^define("BAIKAL_VERSION", "\(.*\)");/\1/p' /data/Core/Distrib.php)" +if [ -n "$configured" ] && [ "$configured" != "$shipped" ]; then + echo "Upgrading the Baikal database from $configured to $shipped" + ( + until curl -s -o /dev/null http://127.0.0.1/; do sleep 1; done + if curl -s "http://127.0.0.1/admin/install/?upgradeConfirmed=1" | grep -q "successfully upgraded"; then + echo "Baikal database upgraded to $shipped" + else + echo "Baikal upgrade failed : open the web admin to see the error" + fi + ) & +fi + # Start app # Find the PHP FPM service script and start it find /etc/init.d -type f -name "php*-fpm" -exec {} start \; \