🐛 Re-seed config if REPLACE_ tokens remain from a broken prior run 🐛

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
This commit is contained in:
2026-06-09 16:07:12 -04:00
parent 6b8527c19b
commit 2a5f7bdbc9
3 changed files with 5 additions and 4 deletions
@@ -267,7 +267,7 @@ __run_precopy() {
# then replace the /etc/$SERVICE_NAME directory with a symlink to /config/$SERVICE_NAME # then replace the /etc/$SERVICE_NAME directory with a symlink to /config/$SERVICE_NAME
# so both paths always resolve to the same processed config. # so both paths always resolve to the same processed config.
if [ -d "$ETC_DIR" ] && ! [ -L "$ETC_DIR" ]; then 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" mkdir -p "$CONF_DIR"
cp -Rf "$ETC_DIR/." "$CONF_DIR/" 2>/dev/null || true cp -Rf "$ETC_DIR/." "$CONF_DIR/" 2>/dev/null || true
fi fi
@@ -304,11 +304,12 @@ __run_precopy() {
# during container startup, after the entrypoint's initial copy. Applying it here # 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. # (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 [ -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 # then replace the /etc/$SERVICE_NAME directory with a symlink to /config/$SERVICE_NAME
# so both paths always resolve to the same processed config. # so both paths always resolve to the same processed config.
if [ -d "$ETC_DIR" ] && ! [ -L "$ETC_DIR" ]; then 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" mkdir -p "$CONF_DIR"
cp -Rf "$ETC_DIR/." "$CONF_DIR/" 2>/dev/null || true cp -Rf "$ETC_DIR/." "$CONF_DIR/" 2>/dev/null || true
fi fi
@@ -337,7 +337,7 @@ __run_precopy() {
# then replace the /etc/$SERVICE_NAME directory with a symlink to /config/$SERVICE_NAME # then replace the /etc/$SERVICE_NAME directory with a symlink to /config/$SERVICE_NAME
# so both paths always resolve to the same processed config. # so both paths always resolve to the same processed config.
if [ -d "$ETC_DIR" ] && ! [ -L "$ETC_DIR" ]; then 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" mkdir -p "$CONF_DIR"
cp -Rf "$ETC_DIR/." "$CONF_DIR/" 2>/dev/null || true cp -Rf "$ETC_DIR/." "$CONF_DIR/" 2>/dev/null || true
fi fi