Ver Fonte

Update Ubuntu install PostgreSQL if the database_host is 127.0.0.1 or ::1

FusionPBX há 4 anos atrás
pai
commit
4ad6ce0b14
1 ficheiros alterados com 19 adições e 11 exclusões
  1. 19 11
      ubuntu/resources/postgresql.sh

+ 19 - 11
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