Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fix: not found error if hook folder contains files but non ending with *.sh #2095

Merged
merged 4 commits into from
Nov 14, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ 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
find "${hook_folder_path}" -type f -maxdepth 1 -iname '*.sh' -print | sort | while read script_file_path; do
dvaerum marked this conversation as resolved.
Show resolved Hide resolved
if ! [ -x "${script_file_path}" ] && [ -f "${script_file_path}" ]; then
dvaerum marked this conversation as resolved.
Show resolved Hide resolved
echo "==> The script \"${script_file_path}\" in the folder \"${hook_folder_path}\" was skipping, because it didn't have the executable flag"
dvaerum marked this conversation as resolved.
Show resolved Hide resolved
continue
Expand Down
Loading