Merge pull request #976 from Algunenano/auto_postgis

Test: Make POSTGIS_VERSION detection automatic
This commit is contained in:
Raúl Marín
2018-06-12 10:09:40 +02:00
committed by GitHub
9 changed files with 25 additions and 9 deletions
+16
View File
@@ -25,6 +25,8 @@ while [ -n "$1" ]; do
elif test "$1" = "--no-sql-download"; then
DOWNLOAD_SQL_FILES=no
shift; continue
else
shift; continue;
fi
done
@@ -70,6 +72,20 @@ echo "PUBLICPASS: ${PUBLICPASS}"
echo "TESTUSER: ${TESTUSER}"
echo "TESTPASS: ${TESTPASS}"
# Sets the env variable POSTGIS_VERSION as Major * 10000 + Minor * 100 + Patch
# For example, for 2.4.5 ~> 20405
auto_postgis_version() {
local POSTGIS_STR=$(psql -c "Select default_version from pg_available_extensions WHERE name = 'postgis';" -t);
local pg_version=$(echo $POSTGIS_STR | awk -F '.' '{print $1 * 10000 + $2 * 100 + $3}')
echo $pg_version
}
if [ -z "$POSTGIS_VERSION" ]; then
export POSTGIS_VERSION=$(auto_postgis_version)
echo "POSTGIS_VERSION: ${POSTGIS_VERSION}"
fi
if test x"$PREPARE_PGSQL" = xyes; then
echo "preparing postgres..."