From 98dee551745d4788c77922479454cb7dd7f8103e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dennis=20V=C3=A6rum?= <6872940+dvaerum@users.noreply.github.com> Date: Sun, 5 Nov 2023 19:15:47 +0000 Subject: [PATCH 1/4] Use `find` to located `*.sh` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Dennis Vestergaard Værum --- docker-entrypoint.sh | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 4c85f6ad5..1d160344b 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -26,13 +26,8 @@ run_path() { echo "=> Searching for scripts (*.sh) to run, located in the folder: ${hook_folder_path}" - if [ -z "$(ls -A "${hook_folder_path}")" ]; then - echo "==> but the hook folder \"$(basename "${hook_folder_path}")\" is empty, so nothing to do" - return 0 - fi - ( - for script_file_path in "${hook_folder_path}/"*.sh; do + find "${hook_folder_path}" -type f -maxdepth 1 -iname '*.sh' -print | sort | while read script_file_path; do if ! [ -x "${script_file_path}" ] && [ -f "${script_file_path}" ]; then echo "==> The script \"${script_file_path}\" in the folder \"${hook_folder_path}\" was skipping, because it didn't have the executable flag" continue From e2aa37deeefcf82a88eaad0a206f62de92de7d60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dennis=20Vestergaard=20V=C3=A6rum?= Date: Sun, 5 Nov 2023 23:11:03 +0100 Subject: [PATCH 2/4] added msg if hook folder does not exist MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Dennis Vestergaard Værum --- docker-entrypoint.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 1d160344b..e875037a2 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -24,6 +24,11 @@ run_path() { local hook_folder_path="/docker-entrypoint-hooks.d/$1" local return_code=0 + if ! [ -d "${hook_folder_path}" ]; then + echo "=> Skipping the folder \"${hook_folder_path}\", because it doesn't exist" + return 0 + fi + echo "=> Searching for scripts (*.sh) to run, located in the folder: ${hook_folder_path}" ( From d7d781037d86f9105a8ec94268a1bc7d00f19b89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dennis=20V=C3=A6rum?= <6872940+dvaerum@users.noreply.github.com> Date: Fri, 10 Nov 2023 21:42:57 +0100 Subject: [PATCH 3/4] Updated info message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: J0WI Signed-off-by: Dennis Værum <6872940+dvaerum@users.noreply.github.com> --- docker-entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index e875037a2..2f8f0c4b5 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -34,7 +34,7 @@ run_path() { ( find "${hook_folder_path}" -type f -maxdepth 1 -iname '*.sh' -print | sort | while read script_file_path; do if ! [ -x "${script_file_path}" ] && [ -f "${script_file_path}" ]; then - echo "==> The script \"${script_file_path}\" in the folder \"${hook_folder_path}\" was skipping, because it didn't have the executable flag" + echo "==> The script \"${script_file_path}\" was skipped, because it didn't have the executable flag" continue fi From 1d51268bf506e8df274b8ac34cbacfae36a5665a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dennis=20V=C3=A6rum?= <6872940+dvaerum@users.noreply.github.com> Date: Fri, 10 Nov 2023 21:44:17 +0100 Subject: [PATCH 4/4] Update docker-entrypoint.sh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Small adjustments Signed-off-by: Dennis Værum <6872940+dvaerum@users.noreply.github.com> --- docker-entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 2f8f0c4b5..edb539a01 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -32,8 +32,8 @@ run_path() { echo "=> Searching for scripts (*.sh) to run, located in the folder: ${hook_folder_path}" ( - find "${hook_folder_path}" -type f -maxdepth 1 -iname '*.sh' -print | sort | while read script_file_path; do - if ! [ -x "${script_file_path}" ] && [ -f "${script_file_path}" ]; then + find "${hook_folder_path}" -type f -maxdepth 1 -iname '*.sh' -print | sort | while read -r script_file_path; do + if ! [ -x "${script_file_path}" ]; then echo "==> The script \"${script_file_path}\" was skipped, because it didn't have the executable flag" continue fi