Skip to content

Commit

Permalink
fix initdb check
Browse files Browse the repository at this point in the history
  • Loading branch information
ccakes committed Aug 31, 2020
1 parent 0fb171f commit 564a6a8
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions files/docker-initdb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -165,19 +165,20 @@ _main() {
exec gosu postgres "$BASH_SOURCE" "$@"
fi

declare -g DATABASE_ALREADY_EXISTS
# look specifically for PG_VERSION, as it is expected in the DB dir
if [ -s "$PGDATA/PG_VERSION" ]; then
DATABASE_ALREADY_EXISTS='true'
fi

# only run initialization on an empty data directory
if [ -z "$DATABASE_ALREADY_EXISTS" ]; then
# check dir permissions to reduce likelihood of half-initialized database
ls /docker-entrypoint-initdb.d/ > /dev/null
echo "==> A"
docker_init_database_dir
echo "==> B"
docker_temp_server_start "$@"
echo "==> C"
docker_process_init_files /docker-entrypoint-initdb.d/*
echo "==> D"
docker_temp_server_stop
echo "==> E"

echo
echo 'PostgreSQL init process complete; ready for start up.'
Expand Down

0 comments on commit 564a6a8

Please sign in to comment.