From 581077b21322e6a9ddfdea2b26129fc8458e230c Mon Sep 17 00:00:00 2001
From: Nikolaus Krismer <nikolaus.krismer@uibk.ac.at>
Date: Thu, 7 Aug 2014 11:11:11 +0200
Subject: [PATCH] reverting to postgresql 9.2 (hope this fixes some performance
 issues)

---
 etc/vagrant/bootstrap.sh | 60 +++++++++++++++++++++++-----------------
 1 file changed, 35 insertions(+), 25 deletions(-)

diff --git a/etc/vagrant/bootstrap.sh b/etc/vagrant/bootstrap.sh
index 63f011a8..bae4c502 100644
--- a/etc/vagrant/bootstrap.sh
+++ b/etc/vagrant/bootstrap.sh
@@ -150,22 +150,21 @@ OSMOSIS_DOWNLOAD_URL="http://bretth.dev.openstreetmap.org/osmosis-build/$OSMOSIS
 POSTGIS_GIT_URL="https://github.com/postgis/postgis.git"
 POSTGIS_VERSION="auto"      # activate to install from repository
 #POSTGIS_VERSION="2.1.3"    # activate to install from source
-POSTGRESQL_VERSION="9.4"
-POSTGRESQL_SHORT_VERSION="94"
+POSTGRESQL_VERSION=""
+POSTGRESQL_SHORT_VERSION=""
 POSTGRESQL_DATA_DIR="/var/lib/pgsql/$POSTGRESQL_VERSION/data"
 POSTGRESQL_GLOB_CONF="$POSTGRESQL_DATA_DIR/postgresql.conf"
 POSTGRESQL_HBA_CONF="$POSTGRESQL_DATA_DIR/pg_hba.conf"
-POSTGRESQL_PKG_NAME="postgresql$POSTGRESQL_SHORT_VERSION"
-POSTGRESQL_SERVICE_NAME="postgresql-$POSTGRESQL_VERSION"
+POSTGRESQL_PKG_NAME="postgresql"
+POSTGRESQL_SERVICE_NAME="postgresql"
 PGROUTING_GIT_URL="https://github.com/pgRouting/pgrouting.git"
 PGROUTING_VERSION="auto"      # activate to install from repository
 #PGROUTING_VERSION="2.0.0"    # activate to install from source
-REPO_CONFIG="/etc/yum.repos.d/fedora-updates.repo"
-REPO_ELGIS="http://elgis.argeo.org/repos/6/elgis-release-6-6_0.noarch.rpm"
-REPO_EPEL="http://fedora.aau.at/epel/6/i386/epel-release-6-8.noarch.rpm"
+REPO_ELGIS="none"
+REPO_EPEL="none"
 REPO_POSTGRESQL=""            # will be set later (depending on architecture)
-REPO_POSTGRESQL_32="http://yum.postgresql.org/9.4/fedora/fedora-20-i686/pgdg-fedora94-9.4-1.noarch.rpm"
-REPO_POSTGRESQL_64="http://yum.postgresql.org/9.4/fedora/fedora-20-x86_64/pgdg-fedora94-9.4-1.noarch.rpm"
+REPO_POSTGRESQL_32="auto"
+REPO_POSTGRESQL_64="auto"
 REPO_RPMFORGE=""              # will be set later (depending on architecture)
 REPO_RPMFORGE_32="http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.i686.rpm"
 REPO_RPMFORGE_64="http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm"
@@ -241,20 +240,29 @@ DISTRI_SUPPORTED=false
 DISTRI_TYPE="Fedora 20"
 DISTRI=$(printf "$DISTRI_NAME" | cut -d " " -f 1)
 if [ "$DISTRI" == "CentOS" ]; then
-	REPO_CONFIG="/etc/yum.repos.d/CentOS-Base.repo"
+	POSTGRESQL_VERSION="9.2"
+	POSTGRESQL_SHORT_VERSION="92"
+
 	if printf "$DISTRI_NAME" | egrep -q " 6." ; then
 		DISTRI_TYPE="CentOS 6"
-		REPO_POSTGRESQL_32="http://yum.postgresql.org/9.4/redhat/rhel-6-i386/pgdg-centos94-9.4-1.noarch.rpm"
-		REPO_POSTGRESQL_64="http://yum.postgresql.org/9.4/redhat/rhel-6-x86_64/pgdg-centos94-9.4-1.noarch.rpm"
+		REPO_ELGIS="http://elgis.argeo.org/repos/6/elgis-release-6-6_0.noarch.rpm"
+		REPO_EPEL="http://fedora.aau.at/epel/6/i386/epel-release-6-8.noarch.rpm"
+		REPO_POSTGRESQL_32="http://yum.postgresql.org/$POSTGRESQL_VERSION/redhat/rhel-6-i386/pgdg-centos$POSTGRESQL_SHORT_VERSION-9.2-6.noarch.rpm"
+		REPO_POSTGRESQL_64="http://yum.postgresql.org/$POSTGRESQL_VERSION/redhat/rhel-6-x86_64/pgdg-centos$POSTGRESQL_SHORT_VERSION-9.2-6.noarch.rpm"
 		DISTRI_SUPPORTED=true
 	elif printf "$DISTRI_NAME" | egrep -q " 7." ; then
 		DISTRI_TYPE="CentOS 7"
+		POSTGRESQL_VERSION="9.4"
+		POSTGRESQL_SHORT_VERSION="94"
 		REPO_EPEL="http://fedora.aau.at/epel/beta/7/x86_64/epel-release-7-0.2.noarch.rpm"
-		REPO_POSTGRESQL_64="http://yum.postgresql.org/9.4/redhat/rhel-7-x86_64/pgdg-centos94-9.4-1.noarch.rpm"
+		REPO_POSTGRESQL_64="http://yum.postgresql.org/$POSTGRESQL_VERSION/redhat/rhel-7-x86_64/pgdg-centos$POSTGRESQL_SHORT_VERSION-9.4-1.noarch.rpm"
 		REPO_RPMFORGE_64="http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm"
 		# Activate centos 7 as soon as hdf5 is available as dependency for postgis (using epel); remember to update documentation of this file at the very top
 #		DISTRI_SUPPORTED=$IS_64_BIT
 	fi
+
+	POSTGRESQL_PKG_NAME="postgresql$POSTGRESQL_SHORT_VERSION"
+	POSTGRESQL_SERVICE_NAME="postgresql-$POSTGRESQL_VERSION"
 elif [ "$DISTRI" == "Fedora"]; then
 	if echo $DISTRI_NAME | egrep -q " 20 (Heisenbug)" ; then
 		DISTRI_SUPPORTED=true
@@ -446,14 +454,7 @@ sed -i 's/SELINUX=enabled/SELINUX=disabled/' $SELINUX_CONFIG
 # Repository preparations  #
 ############################
 
-if $INSTALL_POSTGRES; then
-	if [ "$DISTRI" == "CentOS" ]; then
-		sed -i 's/\[base\]/\[base\]\nexclude=postgresql\*/' $REPO_CONFIG
-		sed -i 's/\[updates\]/\[updates\]\nexclude=postgresql\*/' $REPO_CONFIG
-	else
-		sed -i 's/\[fedora\]/\[fedora\]\nexclude=postgresql\*/' $REPO_CONFIG
-	fi
-
+if [ ! $REPO_ELGIS == "none" ]; then
 	# Postgresql 9.4 needs never version of gdal which is not part of epel yet (so we install elgis repo)
 	if [ $POSTGRESQL_SHORT_VERSION \> "93" ]; then
 		echo "Installing elgis repository"
@@ -461,12 +462,22 @@ if $INSTALL_POSTGRES; then
 		yum -y localinstall $DOWNLOAD_DIR/elgis-repo.rpm >> install_elgis_repo.log 2>&1
 		echo "  - enabled"
 	fi
+fi
 
+if [ ! $REPO_EPEL == "none" ]; then
 	# Epel Repository is needed for dependencies (gdal!) of postgresql/postgis/pgRouting
 	echo "Installing epel repository"
 	fn_download $DOWNLOAD_DIR/epel-repo.rpm $REPO_EPEL
 	yum -y localinstall $DOWNLOAD_DIR/epel-repo.rpm >> install_epel_repo.log 2>&1
 	echo "  - enabled"
+fi
+
+if $INSTALL_POSTGRES; then
+	if [ "$DISTRI" == "CentOS" ]; then
+		REPO_CONFIG="/etc/yum.repos.d/CentOS-Base.repo"
+		sed -i 's/\[base\]/\[base\]\nexclude=postgresql\*/' $REPO_CONFIG
+		sed -i 's/\[updates\]/\[updates\]\nexclude=postgresql\*/' $REPO_CONFIG
+	fi
 
 	echo "Installing $POSTGRESQL_SERVICE_NAME repository"
 	fn_download $DOWNLOAD_DIR/postgresql-repo.rpm $REPO_POSTGRESQL
@@ -490,11 +501,10 @@ echo " Bootstrapping the VM:"
 echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
 echo "Operating system $DISTRI_NAME"
 echo "  - osType: $DISTRI_TYPE"
-if $IS_LOCAL_TEST_DEPLOY; then echo "Starting in local test deploy mode"; fi
-if $IMPORT_SCHEDULES && ! $IMPORT_OSMDATA && ! $IMPORT_OSMDATA_CACHED; then
-	echo "Warning: Schedules will not be imported, since no data from OSM is imported!"
-	IMPORT_SCHEDULES=false
+if [ $DISTRI_TYPE == "Fedora 20" ]; then
+	echo "  - using untested operating system!!"
 fi
+if $IS_LOCAL_TEST_DEPLOY; then echo "Starting in local test deploy mode"; fi
 echo "Installing software:"
 if $INSTALL_HTTPD; then echo "  - apache webserver"; fi
 if $INSTALL_MAVEN; then echo "  - apache maven $MAVEN_VERSION"; fi
-- 
GitLab