You've already forked postgres
mirror of
https://github.com/docker-library/postgres.git
synced 2025-07-28 10:42:06 +03:00
Update order to match other blocks and move "--xlogdir" handling down to where it'll be invoked regardless of our "root" status
This commit is contained in:
@ -38,12 +38,10 @@ if [ "$1" = 'postgres' ] && [ "$(id -u)" = '0' ]; then
|
|||||||
chmod g+s /var/run/postgresql
|
chmod g+s /var/run/postgresql
|
||||||
|
|
||||||
# Create the transaction log directory before initdb is run (below) so the directory is owned by the correct user
|
# Create the transaction log directory before initdb is run (below) so the directory is owned by the correct user
|
||||||
file_env 'POSTGRES_INITDB_XLOGDIR'
|
|
||||||
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
|
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
|
||||||
mkdir -p "$POSTGRES_INITDB_XLOGDIR"
|
mkdir -p "$POSTGRES_INITDB_XLOGDIR"
|
||||||
chmod 700 "$POSTGRES_INITDB_XLOGDIR"
|
|
||||||
chown -R postgres "$POSTGRES_INITDB_XLOGDIR"
|
chown -R postgres "$POSTGRES_INITDB_XLOGDIR"
|
||||||
export POSTGRES_INITDB_ARGS="$POSTGRES_INITDB_ARGS --xlogdir $POSTGRES_INITDB_XLOGDIR"
|
chmod 700 "$POSTGRES_INITDB_XLOGDIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec su-exec postgres "$BASH_SOURCE" "$@"
|
exec su-exec postgres "$BASH_SOURCE" "$@"
|
||||||
@ -57,6 +55,9 @@ if [ "$1" = 'postgres' ]; then
|
|||||||
# look specifically for PG_VERSION, as it is expected in the DB dir
|
# look specifically for PG_VERSION, as it is expected in the DB dir
|
||||||
if [ ! -s "$PGDATA/PG_VERSION" ]; then
|
if [ ! -s "$PGDATA/PG_VERSION" ]; then
|
||||||
file_env 'POSTGRES_INITDB_ARGS'
|
file_env 'POSTGRES_INITDB_ARGS'
|
||||||
|
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
|
||||||
|
export POSTGRES_INITDB_ARGS="$POSTGRES_INITDB_ARGS --xlogdir $POSTGRES_INITDB_XLOGDIR"
|
||||||
|
fi
|
||||||
eval "initdb --username=postgres $POSTGRES_INITDB_ARGS"
|
eval "initdb --username=postgres $POSTGRES_INITDB_ARGS"
|
||||||
|
|
||||||
# check password first so we can output the warning before postgres
|
# check password first so we can output the warning before postgres
|
||||||
|
@ -38,12 +38,10 @@ if [ "$1" = 'postgres' ] && [ "$(id -u)" = '0' ]; then
|
|||||||
chmod g+s /var/run/postgresql
|
chmod g+s /var/run/postgresql
|
||||||
|
|
||||||
# Create the transaction log directory before initdb is run (below) so the directory is owned by the correct user
|
# Create the transaction log directory before initdb is run (below) so the directory is owned by the correct user
|
||||||
file_env 'POSTGRES_INITDB_XLOGDIR'
|
|
||||||
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
|
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
|
||||||
mkdir -p "$POSTGRES_INITDB_XLOGDIR"
|
mkdir -p "$POSTGRES_INITDB_XLOGDIR"
|
||||||
chmod 700 "$POSTGRES_INITDB_XLOGDIR"
|
|
||||||
chown -R postgres "$POSTGRES_INITDB_XLOGDIR"
|
chown -R postgres "$POSTGRES_INITDB_XLOGDIR"
|
||||||
export POSTGRES_INITDB_ARGS="$POSTGRES_INITDB_ARGS --xlogdir $POSTGRES_INITDB_XLOGDIR"
|
chmod 700 "$POSTGRES_INITDB_XLOGDIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec gosu postgres "$BASH_SOURCE" "$@"
|
exec gosu postgres "$BASH_SOURCE" "$@"
|
||||||
@ -57,6 +55,9 @@ if [ "$1" = 'postgres' ]; then
|
|||||||
# look specifically for PG_VERSION, as it is expected in the DB dir
|
# look specifically for PG_VERSION, as it is expected in the DB dir
|
||||||
if [ ! -s "$PGDATA/PG_VERSION" ]; then
|
if [ ! -s "$PGDATA/PG_VERSION" ]; then
|
||||||
file_env 'POSTGRES_INITDB_ARGS'
|
file_env 'POSTGRES_INITDB_ARGS'
|
||||||
|
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
|
||||||
|
export POSTGRES_INITDB_ARGS="$POSTGRES_INITDB_ARGS --xlogdir $POSTGRES_INITDB_XLOGDIR"
|
||||||
|
fi
|
||||||
eval "initdb --username=postgres $POSTGRES_INITDB_ARGS"
|
eval "initdb --username=postgres $POSTGRES_INITDB_ARGS"
|
||||||
|
|
||||||
# check password first so we can output the warning before postgres
|
# check password first so we can output the warning before postgres
|
||||||
|
@ -38,12 +38,10 @@ if [ "$1" = 'postgres' ] && [ "$(id -u)" = '0' ]; then
|
|||||||
chmod g+s /var/run/postgresql
|
chmod g+s /var/run/postgresql
|
||||||
|
|
||||||
# Create the transaction log directory before initdb is run (below) so the directory is owned by the correct user
|
# Create the transaction log directory before initdb is run (below) so the directory is owned by the correct user
|
||||||
file_env 'POSTGRES_INITDB_XLOGDIR'
|
|
||||||
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
|
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
|
||||||
mkdir -p "$POSTGRES_INITDB_XLOGDIR"
|
mkdir -p "$POSTGRES_INITDB_XLOGDIR"
|
||||||
chmod 700 "$POSTGRES_INITDB_XLOGDIR"
|
|
||||||
chown -R postgres "$POSTGRES_INITDB_XLOGDIR"
|
chown -R postgres "$POSTGRES_INITDB_XLOGDIR"
|
||||||
export POSTGRES_INITDB_ARGS="$POSTGRES_INITDB_ARGS --xlogdir $POSTGRES_INITDB_XLOGDIR"
|
chmod 700 "$POSTGRES_INITDB_XLOGDIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec su-exec postgres "$BASH_SOURCE" "$@"
|
exec su-exec postgres "$BASH_SOURCE" "$@"
|
||||||
@ -57,6 +55,9 @@ if [ "$1" = 'postgres' ]; then
|
|||||||
# look specifically for PG_VERSION, as it is expected in the DB dir
|
# look specifically for PG_VERSION, as it is expected in the DB dir
|
||||||
if [ ! -s "$PGDATA/PG_VERSION" ]; then
|
if [ ! -s "$PGDATA/PG_VERSION" ]; then
|
||||||
file_env 'POSTGRES_INITDB_ARGS'
|
file_env 'POSTGRES_INITDB_ARGS'
|
||||||
|
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
|
||||||
|
export POSTGRES_INITDB_ARGS="$POSTGRES_INITDB_ARGS --xlogdir $POSTGRES_INITDB_XLOGDIR"
|
||||||
|
fi
|
||||||
eval "initdb --username=postgres $POSTGRES_INITDB_ARGS"
|
eval "initdb --username=postgres $POSTGRES_INITDB_ARGS"
|
||||||
|
|
||||||
# check password first so we can output the warning before postgres
|
# check password first so we can output the warning before postgres
|
||||||
|
@ -38,12 +38,10 @@ if [ "$1" = 'postgres' ] && [ "$(id -u)" = '0' ]; then
|
|||||||
chmod g+s /var/run/postgresql
|
chmod g+s /var/run/postgresql
|
||||||
|
|
||||||
# Create the transaction log directory before initdb is run (below) so the directory is owned by the correct user
|
# Create the transaction log directory before initdb is run (below) so the directory is owned by the correct user
|
||||||
file_env 'POSTGRES_INITDB_XLOGDIR'
|
|
||||||
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
|
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
|
||||||
mkdir -p "$POSTGRES_INITDB_XLOGDIR"
|
mkdir -p "$POSTGRES_INITDB_XLOGDIR"
|
||||||
chmod 700 "$POSTGRES_INITDB_XLOGDIR"
|
|
||||||
chown -R postgres "$POSTGRES_INITDB_XLOGDIR"
|
chown -R postgres "$POSTGRES_INITDB_XLOGDIR"
|
||||||
export POSTGRES_INITDB_ARGS="$POSTGRES_INITDB_ARGS --xlogdir $POSTGRES_INITDB_XLOGDIR"
|
chmod 700 "$POSTGRES_INITDB_XLOGDIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec gosu postgres "$BASH_SOURCE" "$@"
|
exec gosu postgres "$BASH_SOURCE" "$@"
|
||||||
@ -57,6 +55,9 @@ if [ "$1" = 'postgres' ]; then
|
|||||||
# look specifically for PG_VERSION, as it is expected in the DB dir
|
# look specifically for PG_VERSION, as it is expected in the DB dir
|
||||||
if [ ! -s "$PGDATA/PG_VERSION" ]; then
|
if [ ! -s "$PGDATA/PG_VERSION" ]; then
|
||||||
file_env 'POSTGRES_INITDB_ARGS'
|
file_env 'POSTGRES_INITDB_ARGS'
|
||||||
|
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
|
||||||
|
export POSTGRES_INITDB_ARGS="$POSTGRES_INITDB_ARGS --xlogdir $POSTGRES_INITDB_XLOGDIR"
|
||||||
|
fi
|
||||||
eval "initdb --username=postgres $POSTGRES_INITDB_ARGS"
|
eval "initdb --username=postgres $POSTGRES_INITDB_ARGS"
|
||||||
|
|
||||||
# check password first so we can output the warning before postgres
|
# check password first so we can output the warning before postgres
|
||||||
|
@ -38,12 +38,10 @@ if [ "$1" = 'postgres' ] && [ "$(id -u)" = '0' ]; then
|
|||||||
chmod g+s /var/run/postgresql
|
chmod g+s /var/run/postgresql
|
||||||
|
|
||||||
# Create the transaction log directory before initdb is run (below) so the directory is owned by the correct user
|
# Create the transaction log directory before initdb is run (below) so the directory is owned by the correct user
|
||||||
file_env 'POSTGRES_INITDB_XLOGDIR'
|
|
||||||
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
|
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
|
||||||
mkdir -p "$POSTGRES_INITDB_XLOGDIR"
|
mkdir -p "$POSTGRES_INITDB_XLOGDIR"
|
||||||
chmod 700 "$POSTGRES_INITDB_XLOGDIR"
|
|
||||||
chown -R postgres "$POSTGRES_INITDB_XLOGDIR"
|
chown -R postgres "$POSTGRES_INITDB_XLOGDIR"
|
||||||
export POSTGRES_INITDB_ARGS="$POSTGRES_INITDB_ARGS --xlogdir $POSTGRES_INITDB_XLOGDIR"
|
chmod 700 "$POSTGRES_INITDB_XLOGDIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec su-exec postgres "$BASH_SOURCE" "$@"
|
exec su-exec postgres "$BASH_SOURCE" "$@"
|
||||||
@ -57,6 +55,9 @@ if [ "$1" = 'postgres' ]; then
|
|||||||
# look specifically for PG_VERSION, as it is expected in the DB dir
|
# look specifically for PG_VERSION, as it is expected in the DB dir
|
||||||
if [ ! -s "$PGDATA/PG_VERSION" ]; then
|
if [ ! -s "$PGDATA/PG_VERSION" ]; then
|
||||||
file_env 'POSTGRES_INITDB_ARGS'
|
file_env 'POSTGRES_INITDB_ARGS'
|
||||||
|
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
|
||||||
|
export POSTGRES_INITDB_ARGS="$POSTGRES_INITDB_ARGS --xlogdir $POSTGRES_INITDB_XLOGDIR"
|
||||||
|
fi
|
||||||
eval "initdb --username=postgres $POSTGRES_INITDB_ARGS"
|
eval "initdb --username=postgres $POSTGRES_INITDB_ARGS"
|
||||||
|
|
||||||
# check password first so we can output the warning before postgres
|
# check password first so we can output the warning before postgres
|
||||||
|
@ -38,12 +38,10 @@ if [ "$1" = 'postgres' ] && [ "$(id -u)" = '0' ]; then
|
|||||||
chmod g+s /var/run/postgresql
|
chmod g+s /var/run/postgresql
|
||||||
|
|
||||||
# Create the transaction log directory before initdb is run (below) so the directory is owned by the correct user
|
# Create the transaction log directory before initdb is run (below) so the directory is owned by the correct user
|
||||||
file_env 'POSTGRES_INITDB_XLOGDIR'
|
|
||||||
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
|
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
|
||||||
mkdir -p "$POSTGRES_INITDB_XLOGDIR"
|
mkdir -p "$POSTGRES_INITDB_XLOGDIR"
|
||||||
chmod 700 "$POSTGRES_INITDB_XLOGDIR"
|
|
||||||
chown -R postgres "$POSTGRES_INITDB_XLOGDIR"
|
chown -R postgres "$POSTGRES_INITDB_XLOGDIR"
|
||||||
export POSTGRES_INITDB_ARGS="$POSTGRES_INITDB_ARGS --xlogdir $POSTGRES_INITDB_XLOGDIR"
|
chmod 700 "$POSTGRES_INITDB_XLOGDIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec gosu postgres "$BASH_SOURCE" "$@"
|
exec gosu postgres "$BASH_SOURCE" "$@"
|
||||||
@ -57,6 +55,9 @@ if [ "$1" = 'postgres' ]; then
|
|||||||
# look specifically for PG_VERSION, as it is expected in the DB dir
|
# look specifically for PG_VERSION, as it is expected in the DB dir
|
||||||
if [ ! -s "$PGDATA/PG_VERSION" ]; then
|
if [ ! -s "$PGDATA/PG_VERSION" ]; then
|
||||||
file_env 'POSTGRES_INITDB_ARGS'
|
file_env 'POSTGRES_INITDB_ARGS'
|
||||||
|
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
|
||||||
|
export POSTGRES_INITDB_ARGS="$POSTGRES_INITDB_ARGS --xlogdir $POSTGRES_INITDB_XLOGDIR"
|
||||||
|
fi
|
||||||
eval "initdb --username=postgres $POSTGRES_INITDB_ARGS"
|
eval "initdb --username=postgres $POSTGRES_INITDB_ARGS"
|
||||||
|
|
||||||
# check password first so we can output the warning before postgres
|
# check password first so we can output the warning before postgres
|
||||||
|
@ -38,12 +38,10 @@ if [ "$1" = 'postgres' ] && [ "$(id -u)" = '0' ]; then
|
|||||||
chmod g+s /var/run/postgresql
|
chmod g+s /var/run/postgresql
|
||||||
|
|
||||||
# Create the transaction log directory before initdb is run (below) so the directory is owned by the correct user
|
# Create the transaction log directory before initdb is run (below) so the directory is owned by the correct user
|
||||||
file_env 'POSTGRES_INITDB_XLOGDIR'
|
|
||||||
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
|
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
|
||||||
mkdir -p "$POSTGRES_INITDB_XLOGDIR"
|
mkdir -p "$POSTGRES_INITDB_XLOGDIR"
|
||||||
chmod 700 "$POSTGRES_INITDB_XLOGDIR"
|
|
||||||
chown -R postgres "$POSTGRES_INITDB_XLOGDIR"
|
chown -R postgres "$POSTGRES_INITDB_XLOGDIR"
|
||||||
export POSTGRES_INITDB_ARGS="$POSTGRES_INITDB_ARGS --xlogdir $POSTGRES_INITDB_XLOGDIR"
|
chmod 700 "$POSTGRES_INITDB_XLOGDIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec su-exec postgres "$BASH_SOURCE" "$@"
|
exec su-exec postgres "$BASH_SOURCE" "$@"
|
||||||
@ -57,6 +55,9 @@ if [ "$1" = 'postgres' ]; then
|
|||||||
# look specifically for PG_VERSION, as it is expected in the DB dir
|
# look specifically for PG_VERSION, as it is expected in the DB dir
|
||||||
if [ ! -s "$PGDATA/PG_VERSION" ]; then
|
if [ ! -s "$PGDATA/PG_VERSION" ]; then
|
||||||
file_env 'POSTGRES_INITDB_ARGS'
|
file_env 'POSTGRES_INITDB_ARGS'
|
||||||
|
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
|
||||||
|
export POSTGRES_INITDB_ARGS="$POSTGRES_INITDB_ARGS --xlogdir $POSTGRES_INITDB_XLOGDIR"
|
||||||
|
fi
|
||||||
eval "initdb --username=postgres $POSTGRES_INITDB_ARGS"
|
eval "initdb --username=postgres $POSTGRES_INITDB_ARGS"
|
||||||
|
|
||||||
# check password first so we can output the warning before postgres
|
# check password first so we can output the warning before postgres
|
||||||
|
@ -38,12 +38,10 @@ if [ "$1" = 'postgres' ] && [ "$(id -u)" = '0' ]; then
|
|||||||
chmod g+s /var/run/postgresql
|
chmod g+s /var/run/postgresql
|
||||||
|
|
||||||
# Create the transaction log directory before initdb is run (below) so the directory is owned by the correct user
|
# Create the transaction log directory before initdb is run (below) so the directory is owned by the correct user
|
||||||
file_env 'POSTGRES_INITDB_XLOGDIR'
|
|
||||||
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
|
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
|
||||||
mkdir -p "$POSTGRES_INITDB_XLOGDIR"
|
mkdir -p "$POSTGRES_INITDB_XLOGDIR"
|
||||||
chmod 700 "$POSTGRES_INITDB_XLOGDIR"
|
|
||||||
chown -R postgres "$POSTGRES_INITDB_XLOGDIR"
|
chown -R postgres "$POSTGRES_INITDB_XLOGDIR"
|
||||||
export POSTGRES_INITDB_ARGS="$POSTGRES_INITDB_ARGS --xlogdir $POSTGRES_INITDB_XLOGDIR"
|
chmod 700 "$POSTGRES_INITDB_XLOGDIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec gosu postgres "$BASH_SOURCE" "$@"
|
exec gosu postgres "$BASH_SOURCE" "$@"
|
||||||
@ -57,6 +55,9 @@ if [ "$1" = 'postgres' ]; then
|
|||||||
# look specifically for PG_VERSION, as it is expected in the DB dir
|
# look specifically for PG_VERSION, as it is expected in the DB dir
|
||||||
if [ ! -s "$PGDATA/PG_VERSION" ]; then
|
if [ ! -s "$PGDATA/PG_VERSION" ]; then
|
||||||
file_env 'POSTGRES_INITDB_ARGS'
|
file_env 'POSTGRES_INITDB_ARGS'
|
||||||
|
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
|
||||||
|
export POSTGRES_INITDB_ARGS="$POSTGRES_INITDB_ARGS --xlogdir $POSTGRES_INITDB_XLOGDIR"
|
||||||
|
fi
|
||||||
eval "initdb --username=postgres $POSTGRES_INITDB_ARGS"
|
eval "initdb --username=postgres $POSTGRES_INITDB_ARGS"
|
||||||
|
|
||||||
# check password first so we can output the warning before postgres
|
# check password first so we can output the warning before postgres
|
||||||
|
@ -38,12 +38,10 @@ if [ "$1" = 'postgres' ] && [ "$(id -u)" = '0' ]; then
|
|||||||
chmod g+s /var/run/postgresql
|
chmod g+s /var/run/postgresql
|
||||||
|
|
||||||
# Create the transaction log directory before initdb is run (below) so the directory is owned by the correct user
|
# Create the transaction log directory before initdb is run (below) so the directory is owned by the correct user
|
||||||
file_env 'POSTGRES_INITDB_XLOGDIR'
|
|
||||||
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
|
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
|
||||||
mkdir -p "$POSTGRES_INITDB_XLOGDIR"
|
mkdir -p "$POSTGRES_INITDB_XLOGDIR"
|
||||||
chmod 700 "$POSTGRES_INITDB_XLOGDIR"
|
|
||||||
chown -R postgres "$POSTGRES_INITDB_XLOGDIR"
|
chown -R postgres "$POSTGRES_INITDB_XLOGDIR"
|
||||||
export POSTGRES_INITDB_ARGS="$POSTGRES_INITDB_ARGS --xlogdir $POSTGRES_INITDB_XLOGDIR"
|
chmod 700 "$POSTGRES_INITDB_XLOGDIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec su-exec postgres "$BASH_SOURCE" "$@"
|
exec su-exec postgres "$BASH_SOURCE" "$@"
|
||||||
@ -57,6 +55,9 @@ if [ "$1" = 'postgres' ]; then
|
|||||||
# look specifically for PG_VERSION, as it is expected in the DB dir
|
# look specifically for PG_VERSION, as it is expected in the DB dir
|
||||||
if [ ! -s "$PGDATA/PG_VERSION" ]; then
|
if [ ! -s "$PGDATA/PG_VERSION" ]; then
|
||||||
file_env 'POSTGRES_INITDB_ARGS'
|
file_env 'POSTGRES_INITDB_ARGS'
|
||||||
|
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
|
||||||
|
export POSTGRES_INITDB_ARGS="$POSTGRES_INITDB_ARGS --xlogdir $POSTGRES_INITDB_XLOGDIR"
|
||||||
|
fi
|
||||||
eval "initdb --username=postgres $POSTGRES_INITDB_ARGS"
|
eval "initdb --username=postgres $POSTGRES_INITDB_ARGS"
|
||||||
|
|
||||||
# check password first so we can output the warning before postgres
|
# check password first so we can output the warning before postgres
|
||||||
|
@ -38,12 +38,10 @@ if [ "$1" = 'postgres' ] && [ "$(id -u)" = '0' ]; then
|
|||||||
chmod g+s /var/run/postgresql
|
chmod g+s /var/run/postgresql
|
||||||
|
|
||||||
# Create the transaction log directory before initdb is run (below) so the directory is owned by the correct user
|
# Create the transaction log directory before initdb is run (below) so the directory is owned by the correct user
|
||||||
file_env 'POSTGRES_INITDB_XLOGDIR'
|
|
||||||
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
|
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
|
||||||
mkdir -p "$POSTGRES_INITDB_XLOGDIR"
|
mkdir -p "$POSTGRES_INITDB_XLOGDIR"
|
||||||
chmod 700 "$POSTGRES_INITDB_XLOGDIR"
|
|
||||||
chown -R postgres "$POSTGRES_INITDB_XLOGDIR"
|
chown -R postgres "$POSTGRES_INITDB_XLOGDIR"
|
||||||
export POSTGRES_INITDB_ARGS="$POSTGRES_INITDB_ARGS --xlogdir $POSTGRES_INITDB_XLOGDIR"
|
chmod 700 "$POSTGRES_INITDB_XLOGDIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec gosu postgres "$BASH_SOURCE" "$@"
|
exec gosu postgres "$BASH_SOURCE" "$@"
|
||||||
@ -57,6 +55,9 @@ if [ "$1" = 'postgres' ]; then
|
|||||||
# look specifically for PG_VERSION, as it is expected in the DB dir
|
# look specifically for PG_VERSION, as it is expected in the DB dir
|
||||||
if [ ! -s "$PGDATA/PG_VERSION" ]; then
|
if [ ! -s "$PGDATA/PG_VERSION" ]; then
|
||||||
file_env 'POSTGRES_INITDB_ARGS'
|
file_env 'POSTGRES_INITDB_ARGS'
|
||||||
|
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
|
||||||
|
export POSTGRES_INITDB_ARGS="$POSTGRES_INITDB_ARGS --xlogdir $POSTGRES_INITDB_XLOGDIR"
|
||||||
|
fi
|
||||||
eval "initdb --username=postgres $POSTGRES_INITDB_ARGS"
|
eval "initdb --username=postgres $POSTGRES_INITDB_ARGS"
|
||||||
|
|
||||||
# check password first so we can output the warning before postgres
|
# check password first so we can output the warning before postgres
|
||||||
|
@ -38,12 +38,10 @@ if [ "$1" = 'postgres' ] && [ "$(id -u)" = '0' ]; then
|
|||||||
chmod g+s /var/run/postgresql
|
chmod g+s /var/run/postgresql
|
||||||
|
|
||||||
# Create the transaction log directory before initdb is run (below) so the directory is owned by the correct user
|
# Create the transaction log directory before initdb is run (below) so the directory is owned by the correct user
|
||||||
file_env 'POSTGRES_INITDB_XLOGDIR'
|
|
||||||
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
|
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
|
||||||
mkdir -p "$POSTGRES_INITDB_XLOGDIR"
|
mkdir -p "$POSTGRES_INITDB_XLOGDIR"
|
||||||
chmod 700 "$POSTGRES_INITDB_XLOGDIR"
|
|
||||||
chown -R postgres "$POSTGRES_INITDB_XLOGDIR"
|
chown -R postgres "$POSTGRES_INITDB_XLOGDIR"
|
||||||
export POSTGRES_INITDB_ARGS="$POSTGRES_INITDB_ARGS --xlogdir $POSTGRES_INITDB_XLOGDIR"
|
chmod 700 "$POSTGRES_INITDB_XLOGDIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec gosu postgres "$BASH_SOURCE" "$@"
|
exec gosu postgres "$BASH_SOURCE" "$@"
|
||||||
@ -57,6 +55,9 @@ if [ "$1" = 'postgres' ]; then
|
|||||||
# look specifically for PG_VERSION, as it is expected in the DB dir
|
# look specifically for PG_VERSION, as it is expected in the DB dir
|
||||||
if [ ! -s "$PGDATA/PG_VERSION" ]; then
|
if [ ! -s "$PGDATA/PG_VERSION" ]; then
|
||||||
file_env 'POSTGRES_INITDB_ARGS'
|
file_env 'POSTGRES_INITDB_ARGS'
|
||||||
|
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
|
||||||
|
export POSTGRES_INITDB_ARGS="$POSTGRES_INITDB_ARGS --xlogdir $POSTGRES_INITDB_XLOGDIR"
|
||||||
|
fi
|
||||||
eval "initdb --username=postgres $POSTGRES_INITDB_ARGS"
|
eval "initdb --username=postgres $POSTGRES_INITDB_ARGS"
|
||||||
|
|
||||||
# check password first so we can output the warning before postgres
|
# check password first so we can output the warning before postgres
|
||||||
|
Reference in New Issue
Block a user