From a8e6ba0f4d9b03773b20dadb05e9a875fb4861ce Mon Sep 17 00:00:00 2001 From: ImreSamu Date: Wed, 4 Sep 2024 14:11:44 +0200 Subject: [PATCH] fix postgis version detection --- README.md | 2 +- versions.sh | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 92fb9ee5..6185461b 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ This image ensures that the default database created by the parent `postgres` im Unless `-e POSTGRES_DB` is passed to the container at startup time, this database will be named after the admin user (either `postgres` or the user specified with `-e POSTGRES_USER`). If you would prefer to use the older template database mechanism for enabling PostGIS, the image also provides a PostGIS-enabled template database called `template_postgis`. -## Versions (2024-08-29) +## Versions (2024-09-04) We provide multi-platform image support for the following architectures: diff --git a/versions.sh b/versions.sh index 728ab230..99340ee2 100755 --- a/versions.sh +++ b/versions.sh @@ -346,7 +346,14 @@ declare -A postgisSrcSha256=() declare -A postgisSrcSha1=() for variant in ${postgis_versions}; do _postgisMinor=$(echo "$variant" | cut -d. -f2) - postgisLastTags[$variant]=$(echo "$postgis_all_v3_versions" | grep "^3\.${_postgisMinor}\." | version_reverse_sort | head -n 1 || true) + + # check the latest released 3.x version (so not alpha/beta/rc) + postgisLastTags[$variant]=$(echo "$postgis_all_v3_versions" | grep "^3\.${_postgisMinor}\." | grep -v '[a-zA-Z]' | version_reverse_sort | head -n 1 || true) + # Check if the result is empty + if [[ -z "${postgisLastTags[$variant]}" ]]; then + # If empty, run the command again without excluding pre-releases (alpha/beta/rc) + postgisLastTags[$variant]=$(echo "$postgis_all_v3_versions" | grep "^3\.${_postgisMinor}\." | version_reverse_sort | head -n 1 || true) + fi if [[ ${postgisLastTags[$variant]} =~ [a-zA-Z] ]]; then postgisLastDockerTags[$variant]=${postgisLastTags[$variant]}