From 40c2ca4ea86017a9df2f622f8a9a33a5ca35918b Mon Sep 17 00:00:00 2001
From: Evangelos Foutras <evangelos@foutrelis.com>
Date: Wed, 20 Apr 2022 18:34:27 +0300
Subject: [PATCH] postgres: upgrade_pg: copy config from old cluster

Not much point in vimdiff'ing pg_hba.conf and postgresql.conf.
---
 roles/postgres/files/upgrade_pg.sh | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/roles/postgres/files/upgrade_pg.sh b/roles/postgres/files/upgrade_pg.sh
index 78e3c5d69..183edd438 100755
--- a/roles/postgres/files/upgrade_pg.sh
+++ b/roles/postgres/files/upgrade_pg.sh
@@ -45,14 +45,13 @@ mkdir /var/lib/postgres/data
 chown postgres: /var/lib/postgres/data
 chattr -f +C /var/lib/postgres/data || :
 
+# initialize the new cluster
 su - postgres -c 'initdb --locale en_US.UTF-8 -E UTF8 -D /var/lib/postgres/data'
-vimdiff /var/lib/postgres/{data,data-$FROM_VERSION}/pg_hba.conf
-vimdiff /var/lib/postgres/{data,data-$FROM_VERSION}/postgresql.conf
 
-# copy existing SSL certs from data-$FROM_VERSION to data
-for f in {fullchain,chain,privkey}.pem; do
+# copy existing configuration and SSL certs from the old cluster
+for f in pg_hba.conf postgresql.conf {fullchain,chain,privkey}.pem; do
 	if [[ -e /var/lib/postgres/data-$FROM_VERSION/$f ]]; then
-		cp -avx /var/lib/postgres/{data-$FROM_VERSION,data}/$f
+		cp -av /var/lib/postgres/{data-$FROM_VERSION,data}/$f
 	fi
 done
 
-- 
GitLab