From 857982e10b11fb8a033dfb17ddb6bfd5e72c4a5e Mon Sep 17 00:00:00 2001 From: Stefan - Zipkid - Goethals Date: Wed, 23 Oct 2024 11:53:38 +0200 Subject: [PATCH] Ensure the entrypoint script does not fail on directories existing but not containing any .sh files --- puppetserver/docker-entrypoint.sh | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/puppetserver/docker-entrypoint.sh b/puppetserver/docker-entrypoint.sh index 170f0958..be155292 100755 --- a/puppetserver/docker-entrypoint.sh +++ b/puppetserver/docker-entrypoint.sh @@ -28,8 +28,10 @@ pre_execution_handler() { -exec chmod +x {} \; sync for f in /docker-custom-entrypoint.d/*.sh; do - echo "Running $f" - "$f" + if [[ -f "$f" && -x $(realpath "$f") ]]; then + echo "Running $f" + "$f" + fi done fi } @@ -42,8 +44,10 @@ post_startup_handler() { -exec chmod +x {} \; sync for f in /docker-custom-entrypoint.d/post-startup/*.sh; do - echo "Running $f" - "$f" + if [[ -f "$f" && -x $(realpath "$f") ]]; then + echo "Running $f" + "$f" + fi done fi fi @@ -57,8 +61,10 @@ post_execution_handler() { -exec chmod +x {} \; sync for f in /docker-custom-entrypoint.d/post-execution/*.sh; do - echo "Running $f" - "$f" + if [[ -f "$f" && -x $(realpath "$f") ]]; then + echo "Running $f" + "$f" + fi done fi fi @@ -79,8 +85,10 @@ sigterm_handler() { -exec chmod +x {} \; sync for f in /docker-custom-entrypoint.d/sigterm-handler/*.sh; do - echo "Running $f" - "$f" + if [[ -f "$f" && -x $(realpath "$f") ]]; then + echo "Running $f" + "$f" + fi done fi fi