Skip to content

Commit b927923

Browse files
authored
Merge pull request docker-library#452 from infosiftr/initdb-fails
Allow "initdb.d" scripts to be executed instead of sourced
2 parents 3f8d33c + eff90ef commit b927923

13 files changed

+143
-13
lines changed

10/alpine/docker-entrypoint.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,17 @@ if [ "$1" = 'postgres' ]; then
142142
echo
143143
for f in /docker-entrypoint-initdb.d/*; do
144144
case "$f" in
145-
*.sh) echo "$0: running $f"; . "$f" ;;
145+
*.sh)
146+
# https://github.com/docker-library/postgres/issues/450#issuecomment-393167936
147+
# https://github.com/docker-library/postgres/pull/452
148+
if [ -x "$f" ]; then
149+
echo "$0: running $f"
150+
"$f"
151+
else
152+
echo "$0: sourcing $f"
153+
. "$f"
154+
fi
155+
;;
146156
*.sql) echo "$0: running $f"; "${psql[@]}" -f "$f"; echo ;;
147157
*.sql.gz) echo "$0: running $f"; gunzip -c "$f" | "${psql[@]}"; echo ;;
148158
*) echo "$0: ignoring $f" ;;

10/docker-entrypoint.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,17 @@ if [ "$1" = 'postgres' ]; then
142142
echo
143143
for f in /docker-entrypoint-initdb.d/*; do
144144
case "$f" in
145-
*.sh) echo "$0: running $f"; . "$f" ;;
145+
*.sh)
146+
# https://github.com/docker-library/postgres/issues/450#issuecomment-393167936
147+
# https://github.com/docker-library/postgres/pull/452
148+
if [ -x "$f" ]; then
149+
echo "$0: running $f"
150+
"$f"
151+
else
152+
echo "$0: sourcing $f"
153+
. "$f"
154+
fi
155+
;;
146156
*.sql) echo "$0: running $f"; "${psql[@]}" -f "$f"; echo ;;
147157
*.sql.gz) echo "$0: running $f"; gunzip -c "$f" | "${psql[@]}"; echo ;;
148158
*) echo "$0: ignoring $f" ;;

11/alpine/docker-entrypoint.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,17 @@ if [ "$1" = 'postgres' ]; then
142142
echo
143143
for f in /docker-entrypoint-initdb.d/*; do
144144
case "$f" in
145-
*.sh) echo "$0: running $f"; . "$f" ;;
145+
*.sh)
146+
# https://github.com/docker-library/postgres/issues/450#issuecomment-393167936
147+
# https://github.com/docker-library/postgres/pull/452
148+
if [ -x "$f" ]; then
149+
echo "$0: running $f"
150+
"$f"
151+
else
152+
echo "$0: sourcing $f"
153+
. "$f"
154+
fi
155+
;;
146156
*.sql) echo "$0: running $f"; "${psql[@]}" -f "$f"; echo ;;
147157
*.sql.gz) echo "$0: running $f"; gunzip -c "$f" | "${psql[@]}"; echo ;;
148158
*) echo "$0: ignoring $f" ;;

11/docker-entrypoint.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,17 @@ if [ "$1" = 'postgres' ]; then
142142
echo
143143
for f in /docker-entrypoint-initdb.d/*; do
144144
case "$f" in
145-
*.sh) echo "$0: running $f"; . "$f" ;;
145+
*.sh)
146+
# https://github.com/docker-library/postgres/issues/450#issuecomment-393167936
147+
# https://github.com/docker-library/postgres/pull/452
148+
if [ -x "$f" ]; then
149+
echo "$0: running $f"
150+
"$f"
151+
else
152+
echo "$0: sourcing $f"
153+
. "$f"
154+
fi
155+
;;
146156
*.sql) echo "$0: running $f"; "${psql[@]}" -f "$f"; echo ;;
147157
*.sql.gz) echo "$0: running $f"; gunzip -c "$f" | "${psql[@]}"; echo ;;
148158
*) echo "$0: ignoring $f" ;;

9.3/alpine/docker-entrypoint.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,17 @@ if [ "$1" = 'postgres' ]; then
142142
echo
143143
for f in /docker-entrypoint-initdb.d/*; do
144144
case "$f" in
145-
*.sh) echo "$0: running $f"; . "$f" ;;
145+
*.sh)
146+
# https://github.com/docker-library/postgres/issues/450#issuecomment-393167936
147+
# https://github.com/docker-library/postgres/pull/452
148+
if [ -x "$f" ]; then
149+
echo "$0: running $f"
150+
"$f"
151+
else
152+
echo "$0: sourcing $f"
153+
. "$f"
154+
fi
155+
;;
146156
*.sql) echo "$0: running $f"; "${psql[@]}" -f "$f"; echo ;;
147157
*.sql.gz) echo "$0: running $f"; gunzip -c "$f" | "${psql[@]}"; echo ;;
148158
*) echo "$0: ignoring $f" ;;

9.3/docker-entrypoint.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,17 @@ if [ "$1" = 'postgres' ]; then
142142
echo
143143
for f in /docker-entrypoint-initdb.d/*; do
144144
case "$f" in
145-
*.sh) echo "$0: running $f"; . "$f" ;;
145+
*.sh)
146+
# https://github.com/docker-library/postgres/issues/450#issuecomment-393167936
147+
# https://github.com/docker-library/postgres/pull/452
148+
if [ -x "$f" ]; then
149+
echo "$0: running $f"
150+
"$f"
151+
else
152+
echo "$0: sourcing $f"
153+
. "$f"
154+
fi
155+
;;
146156
*.sql) echo "$0: running $f"; "${psql[@]}" -f "$f"; echo ;;
147157
*.sql.gz) echo "$0: running $f"; gunzip -c "$f" | "${psql[@]}"; echo ;;
148158
*) echo "$0: ignoring $f" ;;

9.4/alpine/docker-entrypoint.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,17 @@ if [ "$1" = 'postgres' ]; then
142142
echo
143143
for f in /docker-entrypoint-initdb.d/*; do
144144
case "$f" in
145-
*.sh) echo "$0: running $f"; . "$f" ;;
145+
*.sh)
146+
# https://github.com/docker-library/postgres/issues/450#issuecomment-393167936
147+
# https://github.com/docker-library/postgres/pull/452
148+
if [ -x "$f" ]; then
149+
echo "$0: running $f"
150+
"$f"
151+
else
152+
echo "$0: sourcing $f"
153+
. "$f"
154+
fi
155+
;;
146156
*.sql) echo "$0: running $f"; "${psql[@]}" -f "$f"; echo ;;
147157
*.sql.gz) echo "$0: running $f"; gunzip -c "$f" | "${psql[@]}"; echo ;;
148158
*) echo "$0: ignoring $f" ;;

9.4/docker-entrypoint.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,17 @@ if [ "$1" = 'postgres' ]; then
142142
echo
143143
for f in /docker-entrypoint-initdb.d/*; do
144144
case "$f" in
145-
*.sh) echo "$0: running $f"; . "$f" ;;
145+
*.sh)
146+
# https://github.com/docker-library/postgres/issues/450#issuecomment-393167936
147+
# https://github.com/docker-library/postgres/pull/452
148+
if [ -x "$f" ]; then
149+
echo "$0: running $f"
150+
"$f"
151+
else
152+
echo "$0: sourcing $f"
153+
. "$f"
154+
fi
155+
;;
146156
*.sql) echo "$0: running $f"; "${psql[@]}" -f "$f"; echo ;;
147157
*.sql.gz) echo "$0: running $f"; gunzip -c "$f" | "${psql[@]}"; echo ;;
148158
*) echo "$0: ignoring $f" ;;

9.5/alpine/docker-entrypoint.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,17 @@ if [ "$1" = 'postgres' ]; then
142142
echo
143143
for f in /docker-entrypoint-initdb.d/*; do
144144
case "$f" in
145-
*.sh) echo "$0: running $f"; . "$f" ;;
145+
*.sh)
146+
# https://github.com/docker-library/postgres/issues/450#issuecomment-393167936
147+
# https://github.com/docker-library/postgres/pull/452
148+
if [ -x "$f" ]; then
149+
echo "$0: running $f"
150+
"$f"
151+
else
152+
echo "$0: sourcing $f"
153+
. "$f"
154+
fi
155+
;;
146156
*.sql) echo "$0: running $f"; "${psql[@]}" -f "$f"; echo ;;
147157
*.sql.gz) echo "$0: running $f"; gunzip -c "$f" | "${psql[@]}"; echo ;;
148158
*) echo "$0: ignoring $f" ;;

9.5/docker-entrypoint.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,17 @@ if [ "$1" = 'postgres' ]; then
142142
echo
143143
for f in /docker-entrypoint-initdb.d/*; do
144144
case "$f" in
145-
*.sh) echo "$0: running $f"; . "$f" ;;
145+
*.sh)
146+
# https://github.com/docker-library/postgres/issues/450#issuecomment-393167936
147+
# https://github.com/docker-library/postgres/pull/452
148+
if [ -x "$f" ]; then
149+
echo "$0: running $f"
150+
"$f"
151+
else
152+
echo "$0: sourcing $f"
153+
. "$f"
154+
fi
155+
;;
146156
*.sql) echo "$0: running $f"; "${psql[@]}" -f "$f"; echo ;;
147157
*.sql.gz) echo "$0: running $f"; gunzip -c "$f" | "${psql[@]}"; echo ;;
148158
*) echo "$0: ignoring $f" ;;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy