From c6d45bfa0430d053a79dfdf8f11ed0bfcde763d2 Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Sat, 2 Oct 2021 13:17:08 +0900 Subject: [PATCH] Fix postgres update for arm32 --- .../postgres/migrate-docker-entrypoint.sh | 21 +++++++++++++++---- .../postgres/migrate-docker-entrypoint.sh | 21 +++++++++++++++---- 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/Generated/postgres/migrate-docker-entrypoint.sh b/Generated/postgres/migrate-docker-entrypoint.sh index b5b38a8..6557a66 100755 --- a/Generated/postgres/migrate-docker-entrypoint.sh +++ b/Generated/postgres/migrate-docker-entrypoint.sh @@ -11,10 +11,23 @@ fi if [[ "$CURRENT_PGVERSION" != "$EXPECTED_PGVERSION" ]] && \ [[ "$CURRENT_PGVERSION" != "" ]]; then sed -i "s/$/ $CURRENT_PGVERSION/" /etc/apt/sources.list.d/pgdg.list - apt-get update && apt-get install -y --no-install-recommends \ - postgresql-$CURRENT_PGVERSION \ - postgresql-contrib-$CURRENT_PGVERSION \ - && rm -rf /var/lib/apt/lists/* + apt-get update + if ! apt-get install -y --no-install-recommends \ + postgresql-$CURRENT_PGVERSION \ + postgresql-contrib-$CURRENT_PGVERSION; then + # On arm32, postgres doesn't ship those packages, so we download + # the binaries from an archive we built from the postgres 9.6.20 image's binaries + FALLBACK="https://aois.blob.core.windows.net/public/$CURRENT_PGVERSION-$(uname -m).tar.gz" + echo "Failure to install postgresql-$CURRENT_PGVERSION and postgresql-contrib-$CURRENT_PGVERSION trying fallback $FALLBACK" + apt-get install -y wget + pushd . > /dev/null + cd /usr/lib/postgresql + wget $FALLBACK + tar -xvf *.tar.gz + rm -f *.tar.gz + popd > /dev/null + echo "Successfully installed PG utilities via the fallback" + fi export PGBINOLD="/usr/lib/postgresql/$CURRENT_PGVERSION/bin" export PGDATABASE="/var/lib/postgresql/data" diff --git a/Production/postgres/migrate-docker-entrypoint.sh b/Production/postgres/migrate-docker-entrypoint.sh index b5b38a8..6557a66 100755 --- a/Production/postgres/migrate-docker-entrypoint.sh +++ b/Production/postgres/migrate-docker-entrypoint.sh @@ -11,10 +11,23 @@ fi if [[ "$CURRENT_PGVERSION" != "$EXPECTED_PGVERSION" ]] && \ [[ "$CURRENT_PGVERSION" != "" ]]; then sed -i "s/$/ $CURRENT_PGVERSION/" /etc/apt/sources.list.d/pgdg.list - apt-get update && apt-get install -y --no-install-recommends \ - postgresql-$CURRENT_PGVERSION \ - postgresql-contrib-$CURRENT_PGVERSION \ - && rm -rf /var/lib/apt/lists/* + apt-get update + if ! apt-get install -y --no-install-recommends \ + postgresql-$CURRENT_PGVERSION \ + postgresql-contrib-$CURRENT_PGVERSION; then + # On arm32, postgres doesn't ship those packages, so we download + # the binaries from an archive we built from the postgres 9.6.20 image's binaries + FALLBACK="https://aois.blob.core.windows.net/public/$CURRENT_PGVERSION-$(uname -m).tar.gz" + echo "Failure to install postgresql-$CURRENT_PGVERSION and postgresql-contrib-$CURRENT_PGVERSION trying fallback $FALLBACK" + apt-get install -y wget + pushd . > /dev/null + cd /usr/lib/postgresql + wget $FALLBACK + tar -xvf *.tar.gz + rm -f *.tar.gz + popd > /dev/null + echo "Successfully installed PG utilities via the fallback" + fi export PGBINOLD="/usr/lib/postgresql/$CURRENT_PGVERSION/bin" export PGDATABASE="/var/lib/postgresql/data"