From d1cc08935c360ea576943708d8766b33c9b1e1f9 Mon Sep 17 00:00:00 2001 From: Joe Ferguson Date: Fri, 11 Oct 2019 13:14:57 -0700 Subject: [PATCH] Improve _is_sourced check --- docker-entrypoint.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 895d1631ef..75fcb02a07 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -27,7 +27,9 @@ file_env() { # check to see if this file is being run or sourced from another script _is_sourced() { # https://unix.stackexchange.com/a/215279 - [ "${FUNCNAME[${#FUNCNAME[@]} - 1]}" == 'source' ] + [ "${#FUNCNAME[@]}" -ge 2 ] \ + && [ "${FUNCNAME[0]}" = '_is_sourced' ] \ + && [ "${FUNCNAME[1]}" = 'source' ] } # used to create initial posgres directories and if run as root, ensure ownership to the "postgres" user