1
0
mirror of https://github.com/docker-library/postgres.git synced 2025-07-28 10:42:06 +03:00

Improve _is_sourced check

This commit is contained in:
Joe Ferguson
2019-10-11 13:14:57 -07:00
parent 6e85168bb0
commit d1cc08935c

View File

@ -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