From 2a5f7bdbc9526e72e987d1c6a8ef25c489c486b6 Mon Sep 17 00:00:00 2001 From: casjay Date: Tue, 9 Jun 2026 16:07:12 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Re-seed=20config=20if=20REPLACE?= =?UTF-8?q?=5F=20tokens=20remain=20from=20a=20broken=20prior=20run=20?= =?UTF-8?q?=F0=9F=90=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous guard (check for missing primary config file) left stale app.ini/daemon.json/default_config.yaml files in place when the volume had an unprocessed copy from a broken earlier run. Gitea then read REPLACE_DATABASE_DIR as a literal path, failed to open the SQLite DB, and redirected to the install wizard. Now also re-copy from /etc if the existing config file still contains any REPLACE_ token, ensuring a clean template is always in place before variable substitution runs. - rootfs/usr/local/etc/docker/init.d/08-gitea.sh: re-seed if REPLACE_ tokens present in app.ini - rootfs/usr/local/etc/docker/init.d/05-dockerd.sh: re-seed if REPLACE_ tokens present in daemon.json - rootfs/usr/local/etc/docker/init.d/zz-act_runner.sh: re-seed if REPLACE_ tokens present in default_config.yaml rootfs/usr/local/etc/docker/init.d/05-dockerd.sh rootfs/usr/local/etc/docker/init.d/08-gitea.sh rootfs/usr/local/etc/docker/init.d/zz-act_runner.sh --- rootfs/usr/local/etc/docker/init.d/05-dockerd.sh | 2 +- rootfs/usr/local/etc/docker/init.d/08-gitea.sh | 5 +++-- rootfs/usr/local/etc/docker/init.d/zz-act_runner.sh | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/rootfs/usr/local/etc/docker/init.d/05-dockerd.sh b/rootfs/usr/local/etc/docker/init.d/05-dockerd.sh index e6558cf..e1e0191 100755 --- a/rootfs/usr/local/etc/docker/init.d/05-dockerd.sh +++ b/rootfs/usr/local/etc/docker/init.d/05-dockerd.sh @@ -267,7 +267,7 @@ __run_precopy() { # then replace the /etc/$SERVICE_NAME directory with a symlink to /config/$SERVICE_NAME # so both paths always resolve to the same processed config. if [ -d "$ETC_DIR" ] && ! [ -L "$ETC_DIR" ]; then - if [ ! -f "$CONF_DIR/daemon.json" ]; then + if [ ! -f "$CONF_DIR/daemon.json" ] || grep -q "REPLACE_" "$CONF_DIR/daemon.json" 2>/dev/null; then mkdir -p "$CONF_DIR" cp -Rf "$ETC_DIR/." "$CONF_DIR/" 2>/dev/null || true fi diff --git a/rootfs/usr/local/etc/docker/init.d/08-gitea.sh b/rootfs/usr/local/etc/docker/init.d/08-gitea.sh index 7a06c71..1ffa6d6 100755 --- a/rootfs/usr/local/etc/docker/init.d/08-gitea.sh +++ b/rootfs/usr/local/etc/docker/init.d/08-gitea.sh @@ -304,11 +304,12 @@ __run_precopy() { # during container startup, after the entrypoint's initial copy. Applying it here # (in the init.d phase) ensures it takes effect after Docker finishes network setup. [ -f "/usr/local/etc/resolv.conf" ] && cp -f "/usr/local/etc/resolv.conf" "/etc/resolv.conf" 2>/dev/null || true - # Seed /config/$SERVICE_NAME from the baked /etc copy if app.ini is missing, + # Seed /config/$SERVICE_NAME from the baked /etc copy if app.ini is missing + # or still contains unprocessed REPLACE_ tokens from a previous broken run, # then replace the /etc/$SERVICE_NAME directory with a symlink to /config/$SERVICE_NAME # so both paths always resolve to the same processed config. if [ -d "$ETC_DIR" ] && ! [ -L "$ETC_DIR" ]; then - if [ ! -f "$CONF_DIR/app.ini" ]; then + if [ ! -f "$CONF_DIR/app.ini" ] || grep -q "REPLACE_" "$CONF_DIR/app.ini" 2>/dev/null; then mkdir -p "$CONF_DIR" cp -Rf "$ETC_DIR/." "$CONF_DIR/" 2>/dev/null || true fi diff --git a/rootfs/usr/local/etc/docker/init.d/zz-act_runner.sh b/rootfs/usr/local/etc/docker/init.d/zz-act_runner.sh index a244991..029bae0 100755 --- a/rootfs/usr/local/etc/docker/init.d/zz-act_runner.sh +++ b/rootfs/usr/local/etc/docker/init.d/zz-act_runner.sh @@ -337,7 +337,7 @@ __run_precopy() { # then replace the /etc/$SERVICE_NAME directory with a symlink to /config/$SERVICE_NAME # so both paths always resolve to the same processed config. if [ -d "$ETC_DIR" ] && ! [ -L "$ETC_DIR" ]; then - if [ ! -f "$CONF_DIR/default_config.yaml" ]; then + if [ ! -f "$CONF_DIR/default_config.yaml" ] || grep -q "REPLACE_" "$CONF_DIR/default_config.yaml" 2>/dev/null; then mkdir -p "$CONF_DIR" cp -Rf "$ETC_DIR/." "$CONF_DIR/" 2>/dev/null || true fi