Skip to content

Commit 9f472f0

Browse files
committed
align all versions
1 parent f451ff9 commit 9f472f0

File tree

26 files changed

+113
-32
lines changed

26 files changed

+113
-32
lines changed

10/Dockerfile.c8s

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions
4343
# to make sure of that.
4444
RUN yum -y module enable postgresql:10 && \
4545
INSTALL_PKGS="rsync tar gettext bind-utils nss_wrapper postgresql-server postgresql-contrib" && \
46+
INSTALL_PKGS="$INSTALL_PKGS procps-ng util-linux postgresql-upgrade" && \
4647
yum -y --setopt=tsflags=nodocs install $INSTALL_PKGS && \
4748
rpm -V $INSTALL_PKGS && \
4849
postgres -V | grep -qe "$POSTGRESQL_VERSION\." && echo "Found VERSION $POSTGRESQL_VERSION" && \

10/Dockerfile.rhel8

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions
4444
# to make sure of that.
4545
RUN yum -y module enable postgresql:10 && \
4646
INSTALL_PKGS="rsync tar gettext bind-utils nss_wrapper postgresql-server postgresql-contrib" && \
47+
INSTALL_PKGS="$INSTALL_PKGS procps-ng util-linux postgresql-upgrade" && \
4748
yum -y --setopt=tsflags=nodocs install $INSTALL_PKGS && \
4849
rpm -V $INSTALL_PKGS && \
4950
postgres -V | grep -qe "$POSTGRESQL_VERSION\." && echo "Found VERSION $POSTGRESQL_VERSION" && \

10/root/usr/share/container-scripts/postgresql/common.sh

+14-5
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ function wait_for_postgresql_master() {
297297
run_pgupgrade ()
298298
(
299299
# Remove .pid file if the file persists after ugly shut down
300-
if [ -f "$PGDATA/postmaster.pid" ] && ! pgrep -f "postgres" > /dev/null; then
300+
if [ -f "$PGDATA/postmaster.pid" ] && ! pg_isready > /dev/null; then
301301
rm -rf "$PGDATA/postmaster.pid"
302302
fi
303303

@@ -311,8 +311,17 @@ run_pgupgrade ()
311311
old_collection=rh-postgresql$old_raw_version
312312
fi
313313

314-
old_pgengine=/opt/rh/$old_collection/root/usr/bin
315-
new_pgengine=/opt/rh/rh-postgresql${new_raw_version}/root/usr/bin
314+
# Backward compatibility for RHEL/CentOS 7
315+
source /etc/os-release
316+
317+
if [[ $VERSION_ID -lt 8 ]]; then
318+
old_pgengine=/opt/rh/$old_collection/root/usr/bin
319+
new_pgengine=/opt/rh/rh-postgresql${new_raw_version}/root/usr/bin
320+
else
321+
old_pgengine=/usr/lib64/pgsql/postgresql-$old_raw_version/bin
322+
new_pgengine=/usr/bin
323+
fi
324+
316325
PGDATA_new="${PGDATA}-new"
317326

318327
printf >&2 "\n========== \$PGDATA upgrade: %s -> %s ==========\n\n" \
@@ -350,9 +359,9 @@ run_pgupgrade ()
350359
# boot up data directory with old postgres once again to make sure
351360
# it was shut down properly, otherwise the upgrade process fails
352361
info_msg "Starting old postgresql once again for a clean shutdown..."
353-
"${old_pgengine}/pg_ctl" start -w --timeout 86400 -o "-h ''"
362+
"${old_pgengine}/pg_ctl" start -w --timeout 86400 -o "-h 127.0.0.1''"
354363
info_msg "Waiting for postgresql to be ready for shutdown again..."
355-
"${old_pgengine}/pg_isready"
364+
"${old_pgengine}/pg_isready" -h 127.0.0.1
356365
info_msg "Shutting down old postgresql cleanly..."
357366
"${old_pgengine}/pg_ctl" stop
358367

12/Dockerfile.c8s

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions
4343
# to make sure of that.
4444
RUN yum -y module enable postgresql:12 && \
4545
INSTALL_PKGS="rsync tar gettext bind-utils nss_wrapper postgresql-server postgresql-contrib" && \
46+
INSTALL_PKGS="$INSTALL_PKGS procps-ng util-linux postgresql-upgrade" && \
4647
INSTALL_PKGS="$INSTALL_PKGS pgaudit" && \
4748
yum -y --setopt=tsflags=nodocs install $INSTALL_PKGS && \
4849
rpm -V $INSTALL_PKGS && \

12/Dockerfile.fedora

+2-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions
4545
# safe in the future. This should *never* change, the last test is there
4646
# to make sure of that.
4747
RUN INSTALL_PKGS="rsync tar gettext bind-utils postgresql-server postgresql-contrib nss_wrapper " && \
48-
INSTALL_PKGS+="findutils xz" && \
48+
INSTALL_PKGS+=" procps-ng util-linux postgresql-upgrade" && \
49+
INSTALL_PKGS+=" findutils xz" && \
4950
INSTALL_PKGS+=" pgaudit" && \
5051
dnf -y module enable postgresql:12 && \
5152
dnf -y --setopt=tsflags=nodocs install $INSTALL_PKGS && \

12/Dockerfile.rhel8

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions
4444
# to make sure of that.
4545
RUN yum -y module enable postgresql:12 && \
4646
INSTALL_PKGS="rsync tar gettext bind-utils nss_wrapper postgresql-server postgresql-contrib" && \
47+
INSTALL_PKGS="$INSTALL_PKGS procps-ng util-linux postgresql-upgrade" && \
4748
INSTALL_PKGS="$INSTALL_PKGS pgaudit" && \
4849
yum -y --setopt=tsflags=nodocs install $INSTALL_PKGS && \
4950
rpm -V $INSTALL_PKGS && \

12/root/usr/share/container-scripts/postgresql/common.sh

+14-5
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ function wait_for_postgresql_master() {
297297
run_pgupgrade ()
298298
(
299299
# Remove .pid file if the file persists after ugly shut down
300-
if [ -f "$PGDATA/postmaster.pid" ] && ! pgrep -f "postgres" > /dev/null; then
300+
if [ -f "$PGDATA/postmaster.pid" ] && ! pg_isready > /dev/null; then
301301
rm -rf "$PGDATA/postmaster.pid"
302302
fi
303303

@@ -311,8 +311,17 @@ run_pgupgrade ()
311311
old_collection=rh-postgresql$old_raw_version
312312
fi
313313

314-
old_pgengine=/opt/rh/$old_collection/root/usr/bin
315-
new_pgengine=/opt/rh/rh-postgresql${new_raw_version}/root/usr/bin
314+
# Backward compatibility for RHEL/CentOS 7
315+
source /etc/os-release
316+
317+
if [[ $VERSION_ID -lt 8 ]]; then
318+
old_pgengine=/opt/rh/$old_collection/root/usr/bin
319+
new_pgengine=/opt/rh/rh-postgresql${new_raw_version}/root/usr/bin
320+
else
321+
old_pgengine=/usr/lib64/pgsql/postgresql-$old_raw_version/bin
322+
new_pgengine=/usr/bin
323+
fi
324+
316325
PGDATA_new="${PGDATA}-new"
317326

318327
printf >&2 "\n========== \$PGDATA upgrade: %s -> %s ==========\n\n" \
@@ -350,9 +359,9 @@ run_pgupgrade ()
350359
# boot up data directory with old postgres once again to make sure
351360
# it was shut down properly, otherwise the upgrade process fails
352361
info_msg "Starting old postgresql once again for a clean shutdown..."
353-
"${old_pgengine}/pg_ctl" start -w --timeout 86400 -o "-h ''"
362+
"${old_pgengine}/pg_ctl" start -w --timeout 86400 -o "-h 127.0.0.1''"
354363
info_msg "Waiting for postgresql to be ready for shutdown again..."
355-
"${old_pgengine}/pg_isready"
364+
"${old_pgengine}/pg_isready" -h 127.0.0.1
356365
info_msg "Shutting down old postgresql cleanly..."
357366
"${old_pgengine}/pg_ctl" stop
358367

13/Dockerfile.c8s

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ RUN yum -y module enable postgresql:13 && \
4545
INSTALL_PKGS="rsync tar gettext bind-utils nss_wrapper postgresql-server postgresql-contrib" && \
4646
INSTALL_PKGS="$INSTALL_PKGS pgaudit" && \
4747
INSTALL_PKGS="$INSTALL_PKGS procps-ng util-linux postgresql-upgrade" && \
48-
yum -y --setopt=tsflags=nodocs --setopt=install_weak_deps=false install $INSTALL_PKGS && \
48+
yum -y --setopt=tsflags=nodocs install $INSTALL_PKGS && \
4949
rpm -V $INSTALL_PKGS && \
5050
postgres -V | grep -qe "$POSTGRESQL_VERSION\." && echo "Found VERSION $POSTGRESQL_VERSION" && \
5151
yum -y reinstall tzdata && \

13/root/usr/share/container-scripts/postgresql/common.sh

+12-3
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ function wait_for_postgresql_master() {
297297
run_pgupgrade ()
298298
(
299299
# Remove .pid file if the file persists after ugly shut down
300-
if [ -f "$PGDATA/postmaster.pid" ] && ! pg_isready > /dev/null ; then
300+
if [ -f "$PGDATA/postmaster.pid" ] && ! pg_isready > /dev/null; then
301301
rm -rf "$PGDATA/postmaster.pid"
302302
fi
303303

@@ -311,8 +311,17 @@ run_pgupgrade ()
311311
old_collection=rh-postgresql$old_raw_version
312312
fi
313313

314-
old_pgengine=/usr/lib64/pgsql/postgresql-$old_raw_version/bin
315-
new_pgengine=/usr/bin
314+
# Backward compatibility for RHEL/CentOS 7
315+
source /etc/os-release
316+
317+
if [[ $VERSION_ID -lt 8 ]]; then
318+
old_pgengine=/opt/rh/$old_collection/root/usr/bin
319+
new_pgengine=/opt/rh/rh-postgresql${new_raw_version}/root/usr/bin
320+
else
321+
old_pgengine=/usr/lib64/pgsql/postgresql-$old_raw_version/bin
322+
new_pgengine=/usr/bin
323+
fi
324+
316325
PGDATA_new="${PGDATA}-new"
317326

318327
printf >&2 "\n========== \$PGDATA upgrade: %s -> %s ==========\n\n" \

14/Dockerfile.fedora

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions
4747
RUN INSTALL_PKGS="rsync tar gettext bind-utils postgresql-server postgresql-contrib nss_wrapper " && \
4848
INSTALL_PKGS+="findutils xz" && \
4949
INSTALL_PKGS+=" pgaudit" && \
50+
INSTALL_PKGS+=" procps-ng util-linux postgresql-upgrade" && \
5051
dnf -y module enable postgresql:14 && \
5152
dnf -y --setopt=tsflags=nodocs install $INSTALL_PKGS && \
5253
rpm -V $INSTALL_PKGS && \

14/root/usr/share/container-scripts/postgresql/common.sh

+14-5
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ function wait_for_postgresql_master() {
297297
run_pgupgrade ()
298298
(
299299
# Remove .pid file if the file persists after ugly shut down
300-
if [ -f "$PGDATA/postmaster.pid" ] && ! pgrep -f "postgres" > /dev/null; then
300+
if [ -f "$PGDATA/postmaster.pid" ] && ! pg_isready > /dev/null; then
301301
rm -rf "$PGDATA/postmaster.pid"
302302
fi
303303

@@ -311,8 +311,17 @@ run_pgupgrade ()
311311
old_collection=rh-postgresql$old_raw_version
312312
fi
313313

314-
old_pgengine=/opt/rh/$old_collection/root/usr/bin
315-
new_pgengine=/opt/rh/rh-postgresql${new_raw_version}/root/usr/bin
314+
# Backward compatibility for RHEL/CentOS 7
315+
source /etc/os-release
316+
317+
if [[ $VERSION_ID -lt 8 ]]; then
318+
old_pgengine=/opt/rh/$old_collection/root/usr/bin
319+
new_pgengine=/opt/rh/rh-postgresql${new_raw_version}/root/usr/bin
320+
else
321+
old_pgengine=/usr/lib64/pgsql/postgresql-$old_raw_version/bin
322+
new_pgengine=/usr/bin
323+
fi
324+
316325
PGDATA_new="${PGDATA}-new"
317326

318327
printf >&2 "\n========== \$PGDATA upgrade: %s -> %s ==========\n\n" \
@@ -350,9 +359,9 @@ run_pgupgrade ()
350359
# boot up data directory with old postgres once again to make sure
351360
# it was shut down properly, otherwise the upgrade process fails
352361
info_msg "Starting old postgresql once again for a clean shutdown..."
353-
"${old_pgengine}/pg_ctl" start -w --timeout 86400 -o "-h ''"
362+
"${old_pgengine}/pg_ctl" start -w --timeout 86400 -o "-h 127.0.0.1''"
354363
info_msg "Waiting for postgresql to be ready for shutdown again..."
355-
"${old_pgengine}/pg_isready"
364+
"${old_pgengine}/pg_isready" -h 127.0.0.1
356365
info_msg "Shutting down old postgresql cleanly..."
357366
"${old_pgengine}/pg_ctl" stop
358367

15/Dockerfile.c8s

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions
4444
RUN yum -y module enable postgresql:15 && \
4545
INSTALL_PKGS="rsync tar gettext bind-utils nss_wrapper postgresql-server postgresql-contrib" && \
4646
INSTALL_PKGS="$INSTALL_PKGS pgaudit" && \
47+
INSTALL_PKGS="$INSTALL_PKGS procps-ng util-linux postgresql-upgrade" && \
4748
yum -y --setopt=tsflags=nodocs install $INSTALL_PKGS && \
4849
rpm -V $INSTALL_PKGS && \
4950
postgres -V | grep -qe "$POSTGRESQL_VERSION\." && echo "Found VERSION $POSTGRESQL_VERSION" && \

15/Dockerfile.c9s

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions
4444
RUN { yum -y module enable postgresql:15 || :; } && \
4545
INSTALL_PKGS="rsync tar gettext bind-utils nss_wrapper postgresql-server postgresql-contrib" && \
4646
INSTALL_PKGS="$INSTALL_PKGS pgaudit" && \
47+
INSTALL_PKGS="$INSTALL_PKGS procps-ng util-linux postgresql-upgrade" && \
4748
yum -y --setopt=tsflags=nodocs install $INSTALL_PKGS && \
4849
rpm -V $INSTALL_PKGS && \
4950
postgres -V | grep -qe "$POSTGRESQL_VERSION\." && echo "Found VERSION $POSTGRESQL_VERSION" && \

15/Dockerfile.fedora

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions
4747
RUN INSTALL_PKGS="rsync tar gettext bind-utils postgresql-server postgresql-contrib nss_wrapper " && \
4848
INSTALL_PKGS+="findutils xz" && \
4949
INSTALL_PKGS+=" pgaudit" && \
50+
INSTALL_PKGS+=" procps-ng util-linux postgresql-upgrade" && \
5051
dnf -y module enable postgresql:15 && \
5152
dnf -y --setopt=tsflags=nodocs install $INSTALL_PKGS && \
5253
rpm -V $INSTALL_PKGS && \

15/Dockerfile.rhel8

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions
4545
RUN yum -y module enable postgresql:15 && \
4646
INSTALL_PKGS="rsync tar gettext bind-utils nss_wrapper postgresql-server postgresql-contrib" && \
4747
INSTALL_PKGS="$INSTALL_PKGS pgaudit" && \
48+
INSTALL_PKGS="$INSTALL_PKGS procps-ng util-linux postgresql-upgrade" && \
4849
yum -y --setopt=tsflags=nodocs install $INSTALL_PKGS && \
4950
rpm -V $INSTALL_PKGS && \
5051
postgres -V | grep -qe "$POSTGRESQL_VERSION\." && echo "Found VERSION $POSTGRESQL_VERSION" && \

15/Dockerfile.rhel9

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions
4545
RUN { yum -y module enable postgresql:15 || :; } && \
4646
INSTALL_PKGS="rsync tar gettext bind-utils nss_wrapper postgresql-server postgresql-contrib" && \
4747
INSTALL_PKGS="$INSTALL_PKGS pgaudit" && \
48+
INSTALL_PKGS="$INSTALL_PKGS procps-ng util-linux postgresql-upgrade" && \
4849
yum -y --setopt=tsflags=nodocs install $INSTALL_PKGS && \
4950
rpm -V $INSTALL_PKGS && \
5051
postgres -V | grep -qe "$POSTGRESQL_VERSION\." && echo "Found VERSION $POSTGRESQL_VERSION" && \

15/root/usr/share/container-scripts/postgresql/common.sh

+14-5
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ function wait_for_postgresql_master() {
297297
run_pgupgrade ()
298298
(
299299
# Remove .pid file if the file persists after ugly shut down
300-
if [ -f "$PGDATA/postmaster.pid" ] && ! pgrep -f "postgres" > /dev/null; then
300+
if [ -f "$PGDATA/postmaster.pid" ] && ! pg_isready > /dev/null; then
301301
rm -rf "$PGDATA/postmaster.pid"
302302
fi
303303

@@ -311,8 +311,17 @@ run_pgupgrade ()
311311
old_collection=rh-postgresql$old_raw_version
312312
fi
313313

314-
old_pgengine=/opt/rh/$old_collection/root/usr/bin
315-
new_pgengine=/opt/rh/rh-postgresql${new_raw_version}/root/usr/bin
314+
# Backward compatibility for RHEL/CentOS 7
315+
source /etc/os-release
316+
317+
if [[ $VERSION_ID -lt 8 ]]; then
318+
old_pgengine=/opt/rh/$old_collection/root/usr/bin
319+
new_pgengine=/opt/rh/rh-postgresql${new_raw_version}/root/usr/bin
320+
else
321+
old_pgengine=/usr/lib64/pgsql/postgresql-$old_raw_version/bin
322+
new_pgengine=/usr/bin
323+
fi
324+
316325
PGDATA_new="${PGDATA}-new"
317326

318327
printf >&2 "\n========== \$PGDATA upgrade: %s -> %s ==========\n\n" \
@@ -350,9 +359,9 @@ run_pgupgrade ()
350359
# boot up data directory with old postgres once again to make sure
351360
# it was shut down properly, otherwise the upgrade process fails
352361
info_msg "Starting old postgresql once again for a clean shutdown..."
353-
"${old_pgengine}/pg_ctl" start -w --timeout 86400 -o "-h ''"
362+
"${old_pgengine}/pg_ctl" start -w --timeout 86400 -o "-h 127.0.0.1''"
354363
info_msg "Waiting for postgresql to be ready for shutdown again..."
355-
"${old_pgengine}/pg_isready"
364+
"${old_pgengine}/pg_isready" -h 127.0.0.1
356365
info_msg "Shutting down old postgresql cleanly..."
357366
"${old_pgengine}/pg_ctl" stop
358367

16/Dockerfile.c8s

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions
4444
RUN yum -y module enable postgresql:16 && \
4545
INSTALL_PKGS="rsync tar gettext bind-utils nss_wrapper postgresql-server postgresql-contrib" && \
4646
INSTALL_PKGS="$INSTALL_PKGS pgaudit" && \
47+
INSTALL_PKGS="$INSTALL_PKGS procps-ng util-linux postgresql-upgrade" && \
4748
yum -y --setopt=tsflags=nodocs install $INSTALL_PKGS && \
4849
rpm -V $INSTALL_PKGS && \
4950
postgres -V | grep -qe "$POSTGRESQL_VERSION\." && echo "Found VERSION $POSTGRESQL_VERSION" && \

16/Dockerfile.c9s

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions
4444
RUN { yum -y module enable postgresql:16 || :; } && \
4545
INSTALL_PKGS="rsync tar gettext bind-utils nss_wrapper postgresql-server postgresql-contrib" && \
4646
INSTALL_PKGS="$INSTALL_PKGS pgaudit" && \
47+
INSTALL_PKGS="$INSTALL_PKGS procps-ng util-linux postgresql-upgrade" && \
4748
yum -y --setopt=tsflags=nodocs install $INSTALL_PKGS && \
4849
rpm -V $INSTALL_PKGS && \
4950
postgres -V | grep -qe "$POSTGRESQL_VERSION\." && echo "Found VERSION $POSTGRESQL_VERSION" && \

16/Dockerfile.fedora

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions
4747
RUN INSTALL_PKGS="rsync tar gettext bind-utils postgresql16-server postgresql16-contrib nss_wrapper " && \
4848
INSTALL_PKGS+="findutils xz" && \
4949
INSTALL_PKGS+=" postgresql16-pgaudit" && \
50+
INSTALL_PKGS+=" procps-ng util-linux postgresql-upgrade" && \
5051
dnf -y --setopt=tsflags=nodocs install $INSTALL_PKGS && \
5152
rpm -V $INSTALL_PKGS && \
5253
postgres -V | grep -qe "$POSTGRESQL_VERSION\." && echo "Found VERSION $POSTGRESQL_VERSION" && \

16/Dockerfile.rhel8

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions
4545
RUN yum -y module enable postgresql:16 && \
4646
INSTALL_PKGS="rsync tar gettext bind-utils nss_wrapper postgresql-server postgresql-contrib" && \
4747
INSTALL_PKGS="$INSTALL_PKGS pgaudit" && \
48+
INSTALL_PKGS="$INSTALL_PKGS procps-ng util-linux postgresql-upgrade" && \
4849
yum -y --setopt=tsflags=nodocs install $INSTALL_PKGS && \
4950
rpm -V $INSTALL_PKGS && \
5051
postgres -V | grep -qe "$POSTGRESQL_VERSION\." && echo "Found VERSION $POSTGRESQL_VERSION" && \

16/Dockerfile.rhel9

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions
4545
RUN { yum -y module enable postgresql:16 || :; } && \
4646
INSTALL_PKGS="rsync tar gettext bind-utils nss_wrapper postgresql-server postgresql-contrib" && \
4747
INSTALL_PKGS="$INSTALL_PKGS pgaudit" && \
48+
INSTALL_PKGS="$INSTALL_PKGS procps-ng util-linux postgresql-upgrade" && \
4849
yum -y --setopt=tsflags=nodocs install $INSTALL_PKGS && \
4950
rpm -V $INSTALL_PKGS && \
5051
postgres -V | grep -qe "$POSTGRESQL_VERSION\." && echo "Found VERSION $POSTGRESQL_VERSION" && \

16/root/usr/share/container-scripts/postgresql/common.sh

+14-5
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ function wait_for_postgresql_master() {
297297
run_pgupgrade ()
298298
(
299299
# Remove .pid file if the file persists after ugly shut down
300-
if [ -f "$PGDATA/postmaster.pid" ] && ! pgrep -f "postgres" > /dev/null; then
300+
if [ -f "$PGDATA/postmaster.pid" ] && ! pg_isready > /dev/null; then
301301
rm -rf "$PGDATA/postmaster.pid"
302302
fi
303303

@@ -311,8 +311,17 @@ run_pgupgrade ()
311311
old_collection=rh-postgresql$old_raw_version
312312
fi
313313

314-
old_pgengine=/opt/rh/$old_collection/root/usr/bin
315-
new_pgengine=/opt/rh/rh-postgresql${new_raw_version}/root/usr/bin
314+
# Backward compatibility for RHEL/CentOS 7
315+
source /etc/os-release
316+
317+
if [[ $VERSION_ID -lt 8 ]]; then
318+
old_pgengine=/opt/rh/$old_collection/root/usr/bin
319+
new_pgengine=/opt/rh/rh-postgresql${new_raw_version}/root/usr/bin
320+
else
321+
old_pgengine=/usr/lib64/pgsql/postgresql-$old_raw_version/bin
322+
new_pgengine=/usr/bin
323+
fi
324+
316325
PGDATA_new="${PGDATA}-new"
317326

318327
printf >&2 "\n========== \$PGDATA upgrade: %s -> %s ==========\n\n" \
@@ -350,9 +359,9 @@ run_pgupgrade ()
350359
# boot up data directory with old postgres once again to make sure
351360
# it was shut down properly, otherwise the upgrade process fails
352361
info_msg "Starting old postgresql once again for a clean shutdown..."
353-
"${old_pgengine}/pg_ctl" start -w --timeout 86400 -o "-h ''"
362+
"${old_pgengine}/pg_ctl" start -w --timeout 86400 -o "-h 127.0.0.1''"
354363
info_msg "Waiting for postgresql to be ready for shutdown again..."
355-
"${old_pgengine}/pg_isready"
364+
"${old_pgengine}/pg_isready" -h 127.0.0.1
356365
info_msg "Shutting down old postgresql cleanly..."
357366
"${old_pgengine}/pg_ctl" stop
358367

src/Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ RUN {{ spec.environment_setup }}
7575
INSTALL_PKGS="$INSTALL_PKGS rh-postgresql{{ spec.short }}-pgaudit" && \
7676
{% elif spec.prod == 'rhel8' or spec.prod == 'rhel9' or spec.prod == 'c9s' or spec.prod == 'c8s' %}
7777
INSTALL_PKGS="$INSTALL_PKGS pgaudit" && \
78+
INSTALL_PKGS="$INSTALL_PKGS procps-ng util-linux postgresql-upgrade" && \
7879
{% endif %}
7980
{% endif %}
8081
yum -y --setopt=tsflags=nodocs install $INSTALL_PKGS && \

src/Dockerfile.fedora

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ COPY root/usr/libexec/fix-permissions /usr/libexec/fix-permissions
5050
# to make sure of that.
5151
{% if spec.version == "16" %}
5252
RUN INSTALL_PKGS="rsync tar gettext bind-utils postgresql16-server postgresql16-contrib nss_wrapper " && \
53+
INSTALL_PKGS+=" procps-ng util-linux postgresql-upgrade" && \
5354
{% else %}
5455
RUN INSTALL_PKGS="rsync tar gettext bind-utils postgresql-server postgresql-contrib nss_wrapper " && \
5556
{% endif %}

0 commit comments

Comments
 (0)