Merge pull request #976 from Algunenano/auto_postgis
Test: Make POSTGIS_VERSION detection automatic
This commit is contained in:
@@ -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..."
|
||||
|
||||
Reference in New Issue
Block a user