From 7a45680d01599d1db75ca91ae2b07786821c26a8 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 19 Jun 2026 12:22:19 +0000 Subject: [PATCH] gitea: always overwrite /config/app.ini when real file exists Gitea's install wizard uses an atomic SaveTo that replaces the symlink at /data/gitea/conf/app.ini with a real file containing the completed install config. On the next restart /config/app.ini (the pre-wizard template) already exists, so the previous guard skipped the copy and the rm deleted the real installed config, wiping DB/security settings. Always copy the real file over /config/app.ini regardless of whether the target already exists. Co-Authored-By: Claude Sonnet 4.6 Claude-Session: https://claude.ai/code/session_01D46Ef3nZZdbVuwUpPhCd4T --- gitea/rootfs/etc/cont-init.d/99-run.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/gitea/rootfs/etc/cont-init.d/99-run.sh b/gitea/rootfs/etc/cont-init.d/99-run.sh index 757e271275..e163ccfb65 100755 --- a/gitea/rootfs/etc/cont-init.d/99-run.sh +++ b/gitea/rootfs/etc/cont-init.d/99-run.sh @@ -9,12 +9,13 @@ set -e # Ensure the gitea conf directory exists mkdir -p /data/gitea/conf -# If a real file (not a symlink) exists, migrate it to /config so users can edit it +# If a real file (not a symlink) exists, move it to /config. +# This covers both the initial migration from older installs and the post-wizard +# case where Gitea's atomic SaveTo replaces the symlink with the completed config. +# Always overwrite /config/app.ini so the installed settings are never discarded. if [ -f "/data/gitea/conf/app.ini" ] && [ ! -L "/data/gitea/conf/app.ini" ]; then - if [ ! -f "/config/app.ini" ]; then - bashio::log.info "Migrating app.ini to addon_config folder for direct access" - cp /data/gitea/conf/app.ini /config/app.ini - fi + bashio::log.info "Moving app.ini to addon_config folder for direct access" + cp /data/gitea/conf/app.ini /config/app.ini rm /data/gitea/conf/app.ini fi