-
Notifications
You must be signed in to change notification settings - Fork 15
/
install_pg
executable file
·31 lines (22 loc) · 1.17 KB
/
install_pg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
# Inspired by https://gist.github.com/petere/6023944
set -eux
# exit early if a custom build is needed
if [ -n "${USE_CUSTOM_PG:-}" ]; then
exit
fi
# Read properties files for common properties for tools
SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
TOOLS_DIR=${1:-"${SCRIPTPATH}"}
source "${TOOLS_DIR}"/toolsvars
# always install postgresql-common
packages="postgresql-common postgresql-contrib-${PGVERSION} libedit-dev libpam0g-dev libselinux1-dev "
# libpq dependency could not be resolved properly for beta versions so that forced the version to be installed
if [ "${PGVERSION}" -gt "${LATEST_STABLE_PG_VERSION}" ]; then
libpq_version=$(sudo apt-cache show libpq5 | grep -i Version: | awk -F ' ' 'NR==1{print $2}')
libpq_dev_version=$(sudo apt-cache show libpq-dev | grep -i Version: | awk -F ' ' 'NR==1{print $2}')
packages="${packages} libpq5=${libpq_version} libpq-dev=${libpq_dev_version}"
fi
packages="$packages postgresql-${PGVERSION} postgresql-client-${PGVERSION} postgresql-server-dev-${PGVERSION}"
# shellcheck disable=SC2086
sudo apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install $packages