Skip to content

Commit

Permalink
Improve _is_sourced check
Browse files Browse the repository at this point in the history
  • Loading branch information
yosifkit committed Oct 11, 2019
1 parent 6e85168 commit d1cc089
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d1cc089

Please sign in to comment.