From 8d1c420de0bb307c83342327e8de8a89ef08cb7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dennis=20Vestergaard=20V=C3=A6rum?= Date: Sat, 13 May 2023 09:04:11 +0200 Subject: [PATCH] =?UTF-8?q?Small=20changes:=20-=20Only=20execute=20shell-s?= =?UTF-8?q?cripts=20(mening=20files=20ending=20with=20.sh)=20-=20Sort=20th?= =?UTF-8?q?e=20files=20before=20executing=20them,=20had=20forgotten=20?= =?UTF-8?q?=F0=9F=98=85=20-=20Added=20a=20message=20when=20a=20hook=20scri?= =?UTF-8?q?pt=20finish=20-=20Added=20prefix=20arror=20to=20message=20to=20?= =?UTF-8?q?show=20the=20are=20related?= 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 | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index d23e9127..fb07f7be 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -24,24 +24,26 @@ run_path() { local hook_folder_path="/docker-entrypoint-hooks.d/$1" local return_code=0 - echo "Searching for scripts to run in the folder: ${hook_folder_path}" + echo "=> Searching for scripts to run in the folder: ${hook_folder_path}" ( cd "${hook_folder_path}" - find . -type f -print | while read script_file_path; do + find . -type f -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}\" in the folder \"${hook_folder_path}\" was skipping, because it didn't have the executable flag" continue fi - echo "Running the script: \"${script_file_path}\"" + echo "==> Running the script: \"${script_file_path}\"" run_as "${script_file_path}" || return_code="$?" if [ "${return_code}" -ne "0" ]; then - echo "Failed at executing \"${script_file_path}\". Exit code: ${return_code}" + echo "==> Failed at executing \"${script_file_path}\". Exit code: ${return_code}" exit 1 fi + + echo "==> Finished the script: \"${script_file_path}\"" done ) }