Skip to content

Commit

Permalink
Merge pull request #60 from cubasepp/postgres-client-version
Browse files Browse the repository at this point in the history
Allow to specify postgres-client-version
  • Loading branch information
rafaelfranca authored Nov 5, 2024
2 parents 54c5e33 + ea1f991 commit cb70847
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
5 changes: 4 additions & 1 deletion features/postgres-client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@ service using the official [Postgres docker image](https://hub.docker.com/_/post
```

## Options
| Options Id | Description | Type | Default Value |
|-----|-----|-----|-----|
| version | The postgres-client version | string | 15 |

## Customizations

## OS Support

This Feature should work on recent versions of Debian/Ubuntu-based distributions with the `apt` package manager installed.

`bash` is required to execute the `install.sh` script.
`bash` is required to execute the `install.sh` script.
13 changes: 12 additions & 1 deletion features/postgres-client/install.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
#!/bin/sh
set -e

apt-get update -y && apt-get -y install --no-install-recommends libpq-dev postgresql-client
export POSTGRES_CLIENT_VERSION="${VERSION:-"15"}"

apt-get update -qq

VERSION_EXISTS=$(apt-cache search --names-only postgresql-client-$POSTGRES_CLIENT_VERSION | wc -l)

if [ "$VERSION_EXISTS" -ge 1 ]; then
apt-get install --no-install-recommends -y postgresql-client-$POSTGRES_CLIENT_VERSION
else
apt-get install --no-install-recommends -y postgresql-common
/usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y && apt-get install --no-install-recommends -y postgresql-client-$POSTGRES_CLIENT_VERSION
fi

rm -rf /var/lib/apt/lists/*

0 comments on commit cb70847

Please sign in to comment.