Skip to content

Commit aaf2098

Browse files
authored
Merge pull request #374 from infosiftr/waldir
Postgres 10 renamed xlog to wal
2 parents b84ddd1 + 1805adb commit aaf2098

File tree

4 files changed

+30
-19
lines changed

4 files changed

+30
-19
lines changed

10/alpine/docker-entrypoint.sh

+6-6
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ if [ "$1" = 'postgres' ] && [ "$(id -u)" = '0' ]; then
3838
chmod 775 /var/run/postgresql
3939

4040
# Create the transaction log directory before initdb is run (below) so the directory is owned by the correct user
41-
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
42-
mkdir -p "$POSTGRES_INITDB_XLOGDIR"
43-
chown -R postgres "$POSTGRES_INITDB_XLOGDIR"
44-
chmod 700 "$POSTGRES_INITDB_XLOGDIR"
41+
if [ "$POSTGRES_INITDB_WALDIR" ]; then
42+
mkdir -p "$POSTGRES_INITDB_WALDIR"
43+
chown -R postgres "$POSTGRES_INITDB_WALDIR"
44+
chmod 700 "$POSTGRES_INITDB_WALDIR"
4545
fi
4646

4747
exec su-exec postgres "$BASH_SOURCE" "$@"
@@ -55,8 +55,8 @@ if [ "$1" = 'postgres' ]; then
5555
# look specifically for PG_VERSION, as it is expected in the DB dir
5656
if [ ! -s "$PGDATA/PG_VERSION" ]; then
5757
file_env 'POSTGRES_INITDB_ARGS'
58-
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
59-
export POSTGRES_INITDB_ARGS="$POSTGRES_INITDB_ARGS --xlogdir $POSTGRES_INITDB_XLOGDIR"
58+
if [ "$POSTGRES_INITDB_WALDIR" ]; then
59+
export POSTGRES_INITDB_ARGS="$POSTGRES_INITDB_ARGS --waldir $POSTGRES_INITDB_WALDIR"
6060
fi
6161
eval "initdb --username=postgres $POSTGRES_INITDB_ARGS"
6262

10/docker-entrypoint.sh

+6-6
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ if [ "$1" = 'postgres' ] && [ "$(id -u)" = '0' ]; then
3838
chmod 775 /var/run/postgresql
3939

4040
# Create the transaction log directory before initdb is run (below) so the directory is owned by the correct user
41-
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
42-
mkdir -p "$POSTGRES_INITDB_XLOGDIR"
43-
chown -R postgres "$POSTGRES_INITDB_XLOGDIR"
44-
chmod 700 "$POSTGRES_INITDB_XLOGDIR"
41+
if [ "$POSTGRES_INITDB_WALDIR" ]; then
42+
mkdir -p "$POSTGRES_INITDB_WALDIR"
43+
chown -R postgres "$POSTGRES_INITDB_WALDIR"
44+
chmod 700 "$POSTGRES_INITDB_WALDIR"
4545
fi
4646

4747
exec gosu postgres "$BASH_SOURCE" "$@"
@@ -55,8 +55,8 @@ if [ "$1" = 'postgres' ]; then
5555
# look specifically for PG_VERSION, as it is expected in the DB dir
5656
if [ ! -s "$PGDATA/PG_VERSION" ]; then
5757
file_env 'POSTGRES_INITDB_ARGS'
58-
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
59-
export POSTGRES_INITDB_ARGS="$POSTGRES_INITDB_ARGS --xlogdir $POSTGRES_INITDB_XLOGDIR"
58+
if [ "$POSTGRES_INITDB_WALDIR" ]; then
59+
export POSTGRES_INITDB_ARGS="$POSTGRES_INITDB_ARGS --waldir $POSTGRES_INITDB_WALDIR"
6060
fi
6161
eval "initdb --username=postgres $POSTGRES_INITDB_ARGS"
6262

docker-entrypoint.sh

+6-6
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ if [ "$1" = 'postgres' ] && [ "$(id -u)" = '0' ]; then
3838
chmod 775 /var/run/postgresql
3939

4040
# Create the transaction log directory before initdb is run (below) so the directory is owned by the correct user
41-
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
42-
mkdir -p "$POSTGRES_INITDB_XLOGDIR"
43-
chown -R postgres "$POSTGRES_INITDB_XLOGDIR"
44-
chmod 700 "$POSTGRES_INITDB_XLOGDIR"
41+
if [ "$POSTGRES_INITDB_WALDIR" ]; then
42+
mkdir -p "$POSTGRES_INITDB_WALDIR"
43+
chown -R postgres "$POSTGRES_INITDB_WALDIR"
44+
chmod 700 "$POSTGRES_INITDB_WALDIR"
4545
fi
4646

4747
exec gosu postgres "$BASH_SOURCE" "$@"
@@ -55,8 +55,8 @@ if [ "$1" = 'postgres' ]; then
5555
# look specifically for PG_VERSION, as it is expected in the DB dir
5656
if [ ! -s "$PGDATA/PG_VERSION" ]; then
5757
file_env 'POSTGRES_INITDB_ARGS'
58-
if [ "$POSTGRES_INITDB_XLOGDIR" ]; then
59-
export POSTGRES_INITDB_ARGS="$POSTGRES_INITDB_ARGS --xlogdir $POSTGRES_INITDB_XLOGDIR"
58+
if [ "$POSTGRES_INITDB_WALDIR" ]; then
59+
export POSTGRES_INITDB_ARGS="$POSTGRES_INITDB_ARGS --waldir $POSTGRES_INITDB_WALDIR"
6060
fi
6161
eval "initdb --username=postgres $POSTGRES_INITDB_ARGS"
6262

update.sh

+12-1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ for version in "${versions[@]}"; do
4343

4444
versionList="$(echo "${suitePackageList["$suite"]}"; curl -fsSL "${packagesBase}/${suite}-pgdg/${version}/binary-amd64/Packages.bz2" | bunzip2)"
4545
fullVersion="$(echo "$versionList" | awk -F ': ' '$1 == "Package" { pkg = $2 } $1 == "Version" && pkg == "postgresql-'"$version"'" { print $2; exit }' || true)"
46+
majorVersion="${version%%.*}"
47+
4648
(
4749
set -x
4850
cp docker-entrypoint.sh "$version/"
@@ -51,7 +53,11 @@ for version in "${versions[@]}"; do
5153
-e 's/%%DEBIAN_SUITE%%/'"$suite"'/g' \
5254
-e 's/%%ARCH_LIST%%/'"${suiteArches["$suite"]}"'/g' \
5355
Dockerfile-debian.template > "$version/Dockerfile"
54-
if [ "$version" = '10' ]; then
56+
if [ "$majorVersion" = '9' ]; then
57+
sed -i -e 's/WALDIR/XLOGDIR/g' \
58+
-e 's/waldir/xlogdir/g' \
59+
"$version/docker-entrypoint.sh"
60+
else
5561
# postgresql-contrib-10 package does not exist, but is provided by postgresql-10
5662
# Packages.gz:
5763
# Package: postgresql-10
@@ -84,6 +90,11 @@ for version in "${versions[@]}"; do
8490
# https://pkgs.alpinelinux.org/contents?file=prove&path=&name=&branch=&repo=&arch=x86_64
8591
sed -ri 's/(\s+perl)(\s+)/\1-utils\2/' "$version/$variant/Dockerfile"
8692
fi
93+
if [ "$majorVersion" = '9' ]; then
94+
sed -i -e 's/WALDIR/XLOGDIR/g' \
95+
-e 's/waldir/xlogdir/g' \
96+
"$version/$variant/docker-entrypoint.sh"
97+
fi
8798

8899
# TODO remove all this when 9.3 is EOL (2018-10-01 -- from http://www.postgresql.org/support/versioning/)
89100
case "$version" in

0 commit comments

Comments
 (0)