From 916a840510b481e7d3f0f74fa04fde3edfdfbd04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Warcha=C5=82?= Date: Tue, 19 Jan 2016 09:57:59 +0100 Subject: [PATCH] Stops docker-entrypoint.sh on psql error This fixes #112 --- 9.0/docker-entrypoint.sh | 6 +++++- 9.1/docker-entrypoint.sh | 6 +++++- 9.2/docker-entrypoint.sh | 6 +++++- 9.3/docker-entrypoint.sh | 6 +++++- 9.4/docker-entrypoint.sh | 6 +++++- 9.5/docker-entrypoint.sh | 6 +++++- docker-entrypoint.sh | 6 +++++- 7 files changed, 35 insertions(+), 7 deletions(-) diff --git a/9.0/docker-entrypoint.sh b/9.0/docker-entrypoint.sh index 4bfeb7611b..95ec772380 100755 --- a/9.0/docker-entrypoint.sh +++ b/9.0/docker-entrypoint.sh @@ -77,7 +77,11 @@ if [ "$1" = 'postgres' ]; then for f in /docker-entrypoint-initdb.d/*; do case "$f" in *.sh) echo "$0: running $f"; . "$f" ;; - *.sql) echo "$0: running $f"; psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < "$f" && echo ;; + *.sql) + echo "$0: running $f"; + psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < "$f" + echo + ;; *) echo "$0: ignoring $f" ;; esac echo diff --git a/9.1/docker-entrypoint.sh b/9.1/docker-entrypoint.sh index 4bfeb7611b..95ec772380 100755 --- a/9.1/docker-entrypoint.sh +++ b/9.1/docker-entrypoint.sh @@ -77,7 +77,11 @@ if [ "$1" = 'postgres' ]; then for f in /docker-entrypoint-initdb.d/*; do case "$f" in *.sh) echo "$0: running $f"; . "$f" ;; - *.sql) echo "$0: running $f"; psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < "$f" && echo ;; + *.sql) + echo "$0: running $f"; + psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < "$f" + echo + ;; *) echo "$0: ignoring $f" ;; esac echo diff --git a/9.2/docker-entrypoint.sh b/9.2/docker-entrypoint.sh index 4bfeb7611b..95ec772380 100755 --- a/9.2/docker-entrypoint.sh +++ b/9.2/docker-entrypoint.sh @@ -77,7 +77,11 @@ if [ "$1" = 'postgres' ]; then for f in /docker-entrypoint-initdb.d/*; do case "$f" in *.sh) echo "$0: running $f"; . "$f" ;; - *.sql) echo "$0: running $f"; psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < "$f" && echo ;; + *.sql) + echo "$0: running $f"; + psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < "$f" + echo + ;; *) echo "$0: ignoring $f" ;; esac echo diff --git a/9.3/docker-entrypoint.sh b/9.3/docker-entrypoint.sh index 4bfeb7611b..95ec772380 100755 --- a/9.3/docker-entrypoint.sh +++ b/9.3/docker-entrypoint.sh @@ -77,7 +77,11 @@ if [ "$1" = 'postgres' ]; then for f in /docker-entrypoint-initdb.d/*; do case "$f" in *.sh) echo "$0: running $f"; . "$f" ;; - *.sql) echo "$0: running $f"; psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < "$f" && echo ;; + *.sql) + echo "$0: running $f"; + psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < "$f" + echo + ;; *) echo "$0: ignoring $f" ;; esac echo diff --git a/9.4/docker-entrypoint.sh b/9.4/docker-entrypoint.sh index 4bfeb7611b..95ec772380 100755 --- a/9.4/docker-entrypoint.sh +++ b/9.4/docker-entrypoint.sh @@ -77,7 +77,11 @@ if [ "$1" = 'postgres' ]; then for f in /docker-entrypoint-initdb.d/*; do case "$f" in *.sh) echo "$0: running $f"; . "$f" ;; - *.sql) echo "$0: running $f"; psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < "$f" && echo ;; + *.sql) + echo "$0: running $f"; + psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < "$f" + echo + ;; *) echo "$0: ignoring $f" ;; esac echo diff --git a/9.5/docker-entrypoint.sh b/9.5/docker-entrypoint.sh index 4bfeb7611b..95ec772380 100755 --- a/9.5/docker-entrypoint.sh +++ b/9.5/docker-entrypoint.sh @@ -77,7 +77,11 @@ if [ "$1" = 'postgres' ]; then for f in /docker-entrypoint-initdb.d/*; do case "$f" in *.sh) echo "$0: running $f"; . "$f" ;; - *.sql) echo "$0: running $f"; psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < "$f" && echo ;; + *.sql) + echo "$0: running $f"; + psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < "$f" + echo + ;; *) echo "$0: ignoring $f" ;; esac echo diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 4bfeb7611b..95ec772380 100755 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -77,7 +77,11 @@ if [ "$1" = 'postgres' ]; then for f in /docker-entrypoint-initdb.d/*; do case "$f" in *.sh) echo "$0: running $f"; . "$f" ;; - *.sql) echo "$0: running $f"; psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < "$f" && echo ;; + *.sql) + echo "$0: running $f"; + psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < "$f" + echo + ;; *) echo "$0: ignoring $f" ;; esac echo