From 53913b92cdfb644ab206d63c4ff2e32ec77581ff Mon Sep 17 00:00:00 2001 From: iexos Date: Sun, 18 Jun 2023 23:03:53 +0200 Subject: [PATCH] pg_upgrade: catch intentionally failing cmd --- entrypoint.postgres.sh.tmpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/entrypoint.postgres.sh.tmpl b/entrypoint.postgres.sh.tmpl index 8289575..8260e50 100644 --- a/entrypoint.postgres.sh.tmpl +++ b/entrypoint.postgres.sh.tmpl @@ -7,7 +7,7 @@ OLDDATA=$PGDATA/old_data NEWDATA=$PGDATA/new_data if [ -e $MIGRATION_MARKER ]; then - echo "FATAL: previous migration not completed. manual restore necessary" + echo "FATAL: migration was started but did not complete in a previous run. manual recovery necessary" exit 1 fi @@ -27,7 +27,7 @@ if [ -n "$DATA_VERSION" -a "$PG_MAJOR" != "$DATA_VERSION" ]; then touch $MIGRATION_MARKER echo "running initdb" # abuse entrypoint script for initdb by making server error out - gosu postgres bash -c "export PGDATA=$NEWDATA ; /usr/local/bin/docker-entrypoint.sh --invalid-arg" + gosu postgres bash -c "export PGDATA=$NEWDATA ; /usr/local/bin/docker-entrypoint.sh --invalid-arg || true" echo "running pg_upgrade" cd /tmp gosu postgres pg_upgrade --link -b /usr/lib/postgresql/$DATA_VERSION/bin -d $OLDDATA -D $NEWDATA -U $POSTGRES_USER