1
0

Fix postgres update for arm32

This commit is contained in:
nicolas.dorier
2021-10-02 13:17:08 +09:00
parent 6cc3583205
commit c6d45bfa04
2 changed files with 34 additions and 8 deletions

View File

@@ -11,10 +11,23 @@ fi
if [[ "$CURRENT_PGVERSION" != "$EXPECTED_PGVERSION" ]] && \ if [[ "$CURRENT_PGVERSION" != "$EXPECTED_PGVERSION" ]] && \
[[ "$CURRENT_PGVERSION" != "" ]]; then [[ "$CURRENT_PGVERSION" != "" ]]; then
sed -i "s/$/ $CURRENT_PGVERSION/" /etc/apt/sources.list.d/pgdg.list sed -i "s/$/ $CURRENT_PGVERSION/" /etc/apt/sources.list.d/pgdg.list
apt-get update && apt-get install -y --no-install-recommends \ apt-get update
postgresql-$CURRENT_PGVERSION \ if ! apt-get install -y --no-install-recommends \
postgresql-contrib-$CURRENT_PGVERSION \ postgresql-$CURRENT_PGVERSION \
&& rm -rf /var/lib/apt/lists/* 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 PGBINOLD="/usr/lib/postgresql/$CURRENT_PGVERSION/bin"
export PGDATABASE="/var/lib/postgresql/data" export PGDATABASE="/var/lib/postgresql/data"

View File

@@ -11,10 +11,23 @@ fi
if [[ "$CURRENT_PGVERSION" != "$EXPECTED_PGVERSION" ]] && \ if [[ "$CURRENT_PGVERSION" != "$EXPECTED_PGVERSION" ]] && \
[[ "$CURRENT_PGVERSION" != "" ]]; then [[ "$CURRENT_PGVERSION" != "" ]]; then
sed -i "s/$/ $CURRENT_PGVERSION/" /etc/apt/sources.list.d/pgdg.list sed -i "s/$/ $CURRENT_PGVERSION/" /etc/apt/sources.list.d/pgdg.list
apt-get update && apt-get install -y --no-install-recommends \ apt-get update
postgresql-$CURRENT_PGVERSION \ if ! apt-get install -y --no-install-recommends \
postgresql-contrib-$CURRENT_PGVERSION \ postgresql-$CURRENT_PGVERSION \
&& rm -rf /var/lib/apt/lists/* 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 PGBINOLD="/usr/lib/postgresql/$CURRENT_PGVERSION/bin"
export PGDATABASE="/var/lib/postgresql/data" export PGDATABASE="/var/lib/postgresql/data"