Skip to content

Commit

Permalink
move CMD exec
Browse files Browse the repository at this point in the history
  • Loading branch information
barcus committed Mar 18, 2022
1 parent 98c3498 commit 719e9b2
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export PGDATANEW=/pg_new/data
export PGUSER="${PGUSER}"

if [ "$#" -eq 0 -o "${1:0:1}" = '-' ]; then
set -- pg_upgrade "$@"
set -- pg_upgrade
fi

if [ "$(id -u)" = '0' ] ;then
Expand Down Expand Up @@ -65,9 +65,12 @@ eval "${PGBINOLD}/pg_ctl -D ${PGDATAOLD} -l logfile stop"
[ -z "${LOCALE}" ] && LOCALE="en_US.utf8"
eval "${PGBINNEW}/initdb --username=${PGUSER} --pgdata=${PGDATANEW} --encoding=${ENCODING} --lc-collate=${LOCALE} --lc-ctype=${LOCALE}"

# run pg_upgrade or launch CMD
if [ "$1" = 'pg_upgrade' ] ;then
# Upgrade DB PG_OLD into PG_NEW
eval "/usr/lib/postgresql/${PG_NEW}/bin/pg_upgrade"
else
exec "$@"
fi

## Update pg config listen_address
Expand All @@ -79,7 +82,3 @@ fi
#host all all 172.17.0.0/16 trust
#EOF
#chown postgres:postgres ${PGDATANEW}/pg_hba.conf

if [ "$1" != 'pg_upgrade' ] ;then
exec "$@"
fi

0 comments on commit 719e9b2

Please sign in to comment.