From c2bba26431b89381f6e1cfcd9ad6ac8af32c154e Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Thu, 21 Sep 2023 15:43:43 -0600 Subject: [PATCH] Initialize the database Install on Debian 12 failed to initialize the database on its own so adding pg_createcluster to do this. --- debian/resources/postgresql.sh | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/debian/resources/postgresql.sh b/debian/resources/postgresql.sh index 29cb7c5..591f7e6 100755 --- a/debian/resources/postgresql.sh +++ b/debian/resources/postgresql.sh @@ -58,15 +58,6 @@ if [ ."$database_repo" = ."2ndquadrant" ]; then fi fi -#systemd -if [ ."$database_host" = ."127.0.0.1" ] || [ ."$database_host" = ."::1" ] ; then - systemctl daemon-reload - systemctl restart postgresql -fi - -#init.d -#/usr/sbin/service postgresql restart - #install the database backup #cp backup/fusionpbx-backup /etc/cron.daily #cp backup/fusionpbx-maintenance /etc/cron.daily @@ -75,9 +66,21 @@ fi #sed -i "s/zzz/$password/g" /etc/cron.daily/fusionpbx-backup #sed -i "s/zzz/$password/g" /etc/cron.daily/fusionpbx-maintenance +#initialize the database +pg_createcluster $database_version main + #replace scram-sha-256 with md5 sed -i /etc/postgresql/$database_version/main/pg_hba.conf -e '/^#/!s/scram-sha-256/md5/g' +#systemd +if [ ."$database_host" = ."127.0.0.1" ] || [ ."$database_host" = ."::1" ] ; then + systemctl daemon-reload + systemctl restart postgresql +fi + +#init.d +#/usr/sbin/service postgresql restart + #move to /tmp to prevent a red herring error when running sudo with psql cwd=$(pwd) cd /tmp