diff options
author | Dennis Værum <6872940+dvaerum@users.noreply.github.com> | 2023-11-15 00:11:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-14 23:11:10 +0000 |
commit | 23d099bc33d5252e03d1ccb3b803f3c51beab9fa (patch) | |
tree | 439bde644e54ca03acc86a389f738897b277d6e3 /docker-entrypoint.sh | |
parent | 2bfad535438ec74046e86def0d737a967c45ce1a (diff) |
Bug fix: not found error if hook folder contains files but non ending with `*.sh` (#2095)
* Use `find` to located `*.sh`
Signed-off-by: Dennis Vestergaard Værum <github@varum.dk>
* added msg if hook folder does not exist
Signed-off-by: Dennis Vestergaard Værum <github@varum.dk>
* Updated info message
Co-authored-by: J0WI <J0WI@users.noreply.github.com>
Signed-off-by: Dennis Værum <6872940+dvaerum@users.noreply.github.com>
* Update docker-entrypoint.sh
Small adjustments
Signed-off-by: Dennis Værum <6872940+dvaerum@users.noreply.github.com>
---------
Signed-off-by: Dennis Vestergaard Værum <github@varum.dk>
Signed-off-by: Dennis Værum <6872940+dvaerum@users.noreply.github.com>
Co-authored-by: J0WI <J0WI@users.noreply.github.com>
Diffstat (limited to 'docker-entrypoint.sh')
-rwxr-xr-x | docker-entrypoint.sh | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 4c85f6ad..edb539a0 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -24,17 +24,17 @@ run_path() { local hook_folder_path="/docker-entrypoint-hooks.d/$1" local return_code=0 - 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" + 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}" + ( - for script_file_path in "${hook_folder_path}/"*.sh; 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" + 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 |