Skip to content

Commit 7c4b756

Browse files
committed
ENT-4231: Preserve the PostgreSQL recovery.conf file on upgrades
It tells PostgreSQL how it should behave as a slave. Changelog: None
1 parent 64a8e11 commit 7c4b756

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

packaging/common/cfengine-hub/postinstall.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,14 @@ if [ ! -d $PREFIX/state/pg/data ]; then
431431
cp -a "$new_pgconfig_file" "$PREFIX/state/pg/data/postgresql.conf"
432432
chown cfpostgres "$PREFIX/state/pg/data/postgresql.conf"
433433
fi
434+
435+
# Preserve the recovery.conf file if it existed, it defines how this
436+
# PostgreSQL should behave as a slave (has to be done AFTER checking/writing
437+
# the postgresql.conf file above).
438+
if [ -f "$BACKUP_DIR/data/recovery.conf" ]; then
439+
cp -a "$BACKUP_DIR/data/recovery.conf" "$PREFIX/state/pg/data/recovery.conf"
440+
chown cfpostgres "$PREFIX/state/pg/data/recovery.conf"
441+
fi
434442
fi
435443
fi
436444

0 commit comments

Comments
 (0)