From e3d9df3ef4b8b6d1f8e73840ba37b3973ca2caf5 Mon Sep 17 00:00:00 2001 From: casjay Date: Fri, 26 Jun 2026 21:06:08 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20=5F=5Fcreate=5Fservice=5Fe?= =?UTF-8?q?nv=20to=20write=20.local.sh=20to=20disk=20=F0=9F=90=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .local.sh block defined stub functions in memory but never wrote the file to disk, so __file_exists_with_content always failed and __create_service_env returned non-zero on every run. Fix: use a heredoc to write the stub functions into .local.sh. - rootfs/usr/local/etc/docker/init.d/zz-mongo-express.sh: write .local.sh via heredoc in __create_service_env; bump version to 202606261600-git rootfs/usr/local/etc/docker/init.d/00-mongodb.sh rootfs/usr/local/etc/docker/init.d/zz-mongo-express.sh --- .../usr/local/etc/docker/init.d/00-mongodb.sh | 29 ++++++++++++++++++- .../etc/docker/init.d/zz-mongo-express.sh | 29 ++++++++++++++++++- 2 files changed, 56 insertions(+), 2 deletions(-) diff --git a/rootfs/usr/local/etc/docker/init.d/00-mongodb.sh b/rootfs/usr/local/etc/docker/init.d/00-mongodb.sh index 286a4b4..b9bf4dd 100644 --- a/rootfs/usr/local/etc/docker/init.d/00-mongodb.sh +++ b/rootfs/usr/local/etc/docker/init.d/00-mongodb.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # shellcheck shell=bash # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -##@Version : 202308222354-git +##@Version : 202606261600-git # @@Author : Jason Hempstead # @@Contact : jason@casjaysdev.pro # @@License : WTFPL @@ -294,6 +294,7 @@ __update_ssl_conf() { } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - __create_service_env() { + local exitCode=0 cat </dev/null # ENV_WORKDIR="${ENV_WORKDIR:-$WORK_DIR}" # change to directory # ENV_WWW_DIR="${ENV_WWW_DIR:-$WWW_DIR}" # set default web dir @@ -314,6 +315,32 @@ __create_service_env() { EOF __file_exists_with_content "/config/env/${SERVICE_NAME:-$SCRIPT_NAME}.sh" || return 1 + if [ ! -f "/config/env/${SERVICE_NAME:-$SCRIPT_NAME}.local.sh" ]; then + cat <<'EOF' >"/config/env/${SERVICE_NAME:-$SCRIPT_NAME}.local.sh" +# - - - - - - - - - - - - - - - - - - - - - - - - - +# Local overrides - sourced after the main env file. +# Redefine any of these functions to customise behaviour. +# - - - - - - - - - - - - - - - - - - - - - - - - - +__run_precopy_local() { true; } +# - - - - - - - - - - - - - - - - - - - - - - - - - +__execute_prerun_local() { true; } +# - - - - - - - - - - - - - - - - - - - - - - - - - +__run_pre_execute_checks_local() { true; } +# - - - - - - - - - - - - - - - - - - - - - - - - - +__update_conf_files_local() { true; } +# - - - - - - - - - - - - - - - - - - - - - - - - - +__pre_execute_local() { true; } +# - - - - - - - - - - - - - - - - - - - - - - - - - +__post_execute_local() { true; } +# - - - - - - - - - - - - - - - - - - - - - - - - - +__pre_message_local() { true; } +# - - - - - - - - - - - - - - - - - - - - - - - - - +__update_ssl_conf_local() { true; } +# - - - - - - - - - - - - - - - - - - - - - - - - - +EOF + fi + __file_exists_with_content "/config/env/${SERVICE_NAME:-$SCRIPT_NAME}.local.sh" || exitCode=$((exitCode + 1)) + return $exitCode } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # script to start server diff --git a/rootfs/usr/local/etc/docker/init.d/zz-mongo-express.sh b/rootfs/usr/local/etc/docker/init.d/zz-mongo-express.sh index 558acbf..be8d605 100644 --- a/rootfs/usr/local/etc/docker/init.d/zz-mongo-express.sh +++ b/rootfs/usr/local/etc/docker/init.d/zz-mongo-express.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # shellcheck shell=bash # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -##@Version : 202308222354-git +##@Version : 202606261600-git # @@Author : Jason Hempstead # @@Contact : jason@casjaysdev.pro # @@License : WTFPL @@ -309,6 +309,7 @@ __update_ssl_conf() { } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - __create_service_env() { + local exitCode=0 cat </dev/null # ENV_WORKDIR="${ENV_WORKDIR:-$WORK_DIR}" # change to directory # ENV_WWW_DIR="${ENV_WWW_DIR:-$WWW_DIR}" # set default web dir @@ -329,6 +330,32 @@ __create_service_env() { EOF __file_exists_with_content "/config/env/${SERVICE_NAME:-$SCRIPT_NAME}.sh" || return 1 + if [ ! -f "/config/env/${SERVICE_NAME:-$SCRIPT_NAME}.local.sh" ]; then + cat <<'EOF' >"/config/env/${SERVICE_NAME:-$SCRIPT_NAME}.local.sh" +# - - - - - - - - - - - - - - - - - - - - - - - - - +# Local overrides - sourced after the main env file. +# Redefine any of these functions to customise behaviour. +# - - - - - - - - - - - - - - - - - - - - - - - - - +__run_precopy_local() { true; } +# - - - - - - - - - - - - - - - - - - - - - - - - - +__execute_prerun_local() { true; } +# - - - - - - - - - - - - - - - - - - - - - - - - - +__run_pre_execute_checks_local() { true; } +# - - - - - - - - - - - - - - - - - - - - - - - - - +__update_conf_files_local() { true; } +# - - - - - - - - - - - - - - - - - - - - - - - - - +__pre_execute_local() { true; } +# - - - - - - - - - - - - - - - - - - - - - - - - - +__post_execute_local() { true; } +# - - - - - - - - - - - - - - - - - - - - - - - - - +__pre_message_local() { true; } +# - - - - - - - - - - - - - - - - - - - - - - - - - +__update_ssl_conf_local() { true; } +# - - - - - - - - - - - - - - - - - - - - - - - - - +EOF + fi + __file_exists_with_content "/config/env/${SERVICE_NAME:-$SCRIPT_NAME}.local.sh" || exitCode=$((exitCode + 1)) + return $exitCode } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # script to start server