2020-10-07 13:49:40 +05:00
|
|
|
#!/bin/bash -e
|
2020-01-31 12:21:33 +03:00
|
|
|
################################################################################
|
|
|
|
|
## File: postgresql.sh
|
2021-11-16 11:48:38 +03:00
|
|
|
## Desc: Installs PostgreSQL
|
2020-01-31 12:21:33 +03:00
|
|
|
################################################################################
|
|
|
|
|
|
2021-11-16 11:48:38 +03:00
|
|
|
# Source the helpers
|
|
|
|
|
source $HELPER_SCRIPTS/os.sh
|
|
|
|
|
source $HELPER_SCRIPTS/install.sh
|
|
|
|
|
|
2021-04-07 13:57:35 +03:00
|
|
|
REPO_URL="https://apt.postgresql.org/pub/repos/apt/"
|
|
|
|
|
|
2021-11-16 11:48:38 +03:00
|
|
|
# Preparing repo for PostgreSQL
|
2020-06-02 19:52:42 +07:00
|
|
|
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add -
|
2021-11-16 11:48:38 +03:00
|
|
|
echo "deb $REPO_URL $(getOSVersionLabel)-pgdg main" | tee /etc/apt/sources.list.d/pgdg.list
|
|
|
|
|
|
|
|
|
|
# Fetch PostgreSQL version to install from the toolset
|
|
|
|
|
toolsetVersion=$(get_toolset_value '.postgresql.version')
|
2020-06-02 19:52:42 +07:00
|
|
|
|
2021-11-16 11:48:38 +03:00
|
|
|
# Install PostgreSQL
|
2020-06-02 19:52:42 +07:00
|
|
|
echo "Install PostgreSQL"
|
|
|
|
|
apt update
|
2021-11-16 11:48:38 +03:00
|
|
|
apt install postgresql-$toolsetVersion
|
2020-06-02 19:52:42 +07:00
|
|
|
|
2020-01-31 12:21:33 +03:00
|
|
|
echo "Install libpq-dev"
|
|
|
|
|
apt-get install libpq-dev
|
|
|
|
|
|
2020-06-02 19:52:42 +07:00
|
|
|
# Disable postgresql.service
|
|
|
|
|
systemctl is-active --quiet postgresql.service && systemctl stop postgresql.service
|
2020-10-07 13:49:40 +05:00
|
|
|
systemctl disable postgresql.service
|
2020-12-30 18:04:55 +03:00
|
|
|
|
2021-04-07 13:57:35 +03:00
|
|
|
rm /etc/apt/sources.list.d/pgdg.list
|
|
|
|
|
|
|
|
|
|
echo "postgresql $REPO_URL" >> $HELPER_SCRIPTS/apt-sources.txt
|
|
|
|
|
|
2020-12-30 18:04:55 +03:00
|
|
|
invoke_tests "Databases" "PostgreSQL"
|