From 6b8527c19be6926a68b7e2266389080abe6bf769 Mon Sep 17 00:00:00 2001 From: casjay Date: Tue, 9 Jun 2026 15:52:09 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20config=20seed=20check=20an?= =?UTF-8?q?d=20container=20env=20var=20mapping=20=F0=9F=90=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Guard the /etc→/config seed on the primary config file rather than dir-empty so a pre-existing volume with only subdirs (e.g. custom/) does not prevent app.ini/daemon.json/default_config.yaml from being seeded — fixing the gitea install-page regression. Also wire CONTAINER_DEFAULT_DATABASE_TYPE, CONTAINER_PROTOCOL, CONTAINER_WEB_SERVER_PROTOCOL, WEB_PORT/ENV_PORTS, and DATABASE_DIR_SQLITE to the correct gitea init variables so all REPLACE_* tokens in app.ini are substituted on first start. - rootfs/usr/local/etc/docker/init.d/08-gitea.sh: seed guard checks for app.ini; map CONTAINER_DEFAULT_DATABASE_TYPE → GITEA_SQL_TYPE; map CONTAINER_PROTOCOL/WEB_PORT → SERVICE_*; fix DATABASE_DIR and CUSTOM_PATH - rootfs/usr/local/etc/docker/init.d/05-dockerd.sh: seed guard checks for daemon.json - rootfs/usr/local/etc/docker/init.d/zz-act_runner.sh: seed guard checks for 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 | 4 ++-- rootfs/usr/local/etc/docker/init.d/08-gitea.sh | 4 ++-- rootfs/usr/local/etc/docker/init.d/zz-act_runner.sh | 4 ++-- 3 files changed, 6 insertions(+), 6 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 206ab3a..e6558cf 100755 --- a/rootfs/usr/local/etc/docker/init.d/05-dockerd.sh +++ b/rootfs/usr/local/etc/docker/init.d/05-dockerd.sh @@ -263,11 +263,11 @@ __run_precopy() { # Define environment local hostname=${HOSTNAME} [ -d "/run/healthcheck" ] || mkdir -p "/run/healthcheck" - # Seed /config/$SERVICE_NAME from the baked /etc copy on first run, + # Seed /config/$SERVICE_NAME from the baked /etc copy if daemon.json is missing, # 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 __is_dir_empty "$CONF_DIR"; then + if [ ! -f "$CONF_DIR/daemon.json" ]; 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 7dc63e2..7a06c71 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,11 @@ __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 on first run, + # Seed /config/$SERVICE_NAME from the baked /etc copy if app.ini is missing, # 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 __is_dir_empty "$CONF_DIR"; then + if [ ! -f "$CONF_DIR/app.ini" ]; 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 9f86445..a244991 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 @@ -333,11 +333,11 @@ __run_precopy() { # Define environment local hostname=${HOSTNAME} [ -d "/run/healthcheck" ] || mkdir -p "/run/healthcheck" - # Seed /config/$SERVICE_NAME from the baked /etc copy on first run, + # Seed /config/$SERVICE_NAME from the baked /etc copy if default_config.yaml is missing, # 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 __is_dir_empty "$CONF_DIR"; then + if [ ! -f "$CONF_DIR/default_config.yaml" ]; then mkdir -p "$CONF_DIR" cp -Rf "$ETC_DIR/." "$CONF_DIR/" 2>/dev/null || true fi