taler-deployment

Deployment scripts and configuration files
Log | Files | Refs | README

commit 817ea70d9deb3cc1334bac84e6df1f17f150ff59
parent 39cb0575a0ad8c55003e5fa16f1db3b97c768a62
Author: Christian Grothoff <christian@grothoff.org>
Date:   Thu, 12 Sep 2024 23:06:15 +0200

auto-detect latest available postgres version (#9088)

Diffstat:
Mregional-currency/install_packages.sh | 15+++++++++++----
Aregional-currency/postgres_version.sh | 9+++++++++
2 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/regional-currency/install_packages.sh b/regional-currency/install_packages.sh @@ -8,7 +8,14 @@ source functions.sh detect_distro # Program versions -PG_VERSION=15 +PG_VERSION=$( ./postgres_version.sh ) + +if [[ "$PG_VERSION" -lt 15 ]] +then + echo "Available postgresql version $PG_VERSION is too old" + exit 1 +fi + say "Installing necessary packages (this may take a while)..." @@ -27,8 +34,8 @@ apt-get install \ wget \ nginx \ gettext-base \ - postgresql-${PG_VERSION} \ - postgresql-client-${PG_VERSION} \ + "postgresql-${PG_VERSION}" \ + "postgresql-client-${PG_VERSION}" \ dbconfig-pgsql \ certbot \ python3-sphinx \ @@ -48,7 +55,7 @@ say "Detected distro $DISTRO" case $DISTRO in debian) - if test ${APT_NIGHTLY:-n} == y; then + if test "${APT_NIGHTLY:-n}" == y; then say "Setup nightly packages" echo "deb [trusted=yes] https://deb.taler.net/apt-nightly bookworm main" >/etc/apt/sources.list.d/taler.list else diff --git a/regional-currency/postgres_version.sh b/regional-currency/postgres_version.sh @@ -0,0 +1,9 @@ +#!/bin/sh +apt-cache search "postgresql-" \ + | grep "^postgres" \ + | grep "Advanced" \ + | grep "Database" \ + | sort -r \ + | head -n 1 \ + | sed -e "s/postgresql-//" \ + | awk '{print $1}'