pg_upgrade: catch intentionally failing cmd

This commit is contained in:
iexos 2023-06-18 23:03:53 +02:00
parent e0cc0ff9af
commit 53913b92cd
1 changed files with 2 additions and 2 deletions

View File

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