From 4ad6ce0b14337f70ed167c9bf70de7d744acabc2 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Mon, 7 Jun 2021 19:00:20 -0600 Subject: [PATCH] Update Ubuntu install PostgreSQL if the database_host is 127.0.0.1 or ::1 --- ubuntu/resources/postgresql.sh | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/ubuntu/resources/postgresql.sh b/ubuntu/resources/postgresql.sh index 31584bd..3cc1aa2 100755 --- a/ubuntu/resources/postgresql.sh +++ b/ubuntu/resources/postgresql.sh @@ -27,22 +27,30 @@ if [ ."$database_repo" = ."official" ]; then echo "deb http://apt.postgresql.org/pub/repos/apt/ $os_codename-pgdg main" > /etc/apt/sources.list.d/postgresql.list wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - apt-get update && apt-get upgrade -y - if [ ."$database_version" = ."latest" ]; then - apt-get install -y sudo postgresql + if [ ."$database_host" = ."127.0.0.1" ] || [ ."$database_host" = ."::1" ] ; then + if [ ."$database_version" = ."latest" ]; then + apt-get install -y sudo postgresql + fi + if [ ."$database_version" = ."9.6" ]; then + apt-get install -y sudo postgresql-$database_version + fi + if [ ."$database_version" = ."9.4" ]; then + apt-get install -y sudo postgresql-$database_version + fi fi - if [ ."$database_version" = ."9.6" ]; then - apt-get install -y sudo postgresql-$database_version - fi - if [ ."$database_version" = ."9.4" ]; then - apt-get install -y sudo postgresql-$database_version - fi fi #add PostgreSQL and 2ndquadrant repos if [ ."$database_repo" = ."2ndquadrant" ]; then - apt install -y curl - curl https://dl.2ndquadrant.com/default/release/get/deb | bash - apt-get install -y sudo postgresql-bdr-9.4 postgresql-bdr-9.4-bdr-plugin postgresql-bdr-contrib-9.4 + if [ ."$database_host" = ."127.0.0.1" ] || [ ."$database_host" = ."::1" ] ; then + apt install -y curl + curl https://dl.2ndquadrant.com/default/release/get/deb | bash + if [ ."$os_codename" = ."focal" ]; then + sed -i /etc/apt/sources.list.d/2ndquadrant-dl-default-release.list -e 's#focal#bionic#g' + fi + apt update + apt-get install -y sudo postgresql-bdr-9.4 postgresql-bdr-9.4-bdr-plugin postgresql-bdr-contrib-9.4 + fi fi #add additional dependencies