PosgreSQL: Add version choice (#8103)

* Add version choice

* Update

* Update
This commit is contained in:
Slaviša Arežina
2025-10-04 18:45:02 +02:00
committed by GitHub
parent aded2cbd56
commit e39dd5ffa3
3 changed files with 22 additions and 13 deletions

View File

@@ -13,9 +13,11 @@ setting_up_container
network_check
update_os
PG_VERSION="17" setup_postgresql
read -r -p "${TAB3}Enter PostgreSQL version (15/16/17/18): " ver
[[ $ver =~ ^(15|16|17|18)$ ]] || { echo "Invalid version"; exit 1; }
PG_VERSION=$ver setup_postgresql
cat <<EOF >/etc/postgresql/17/main/pg_hba.conf
cat <<EOF >/etc/postgresql/$ver/main/pg_hba.conf
# PostgreSQL Client Authentication Configuration File
local all postgres peer
# TYPE DATABASE USER ADDRESS METHOD
@@ -34,7 +36,7 @@ host replication all 127.0.0.1/32 scram-sha-256
host replication all ::1/128 scram-sha-256
EOF
cat <<EOF >/etc/postgresql/17/main/postgresql.conf
cat <<EOF >/etc/postgresql/$ver/main/postgresql.conf
# -----------------------------
# PostgreSQL configuration file
# -----------------------------
@@ -43,10 +45,10 @@ cat <<EOF >/etc/postgresql/17/main/postgresql.conf
# FILE LOCATIONS
#------------------------------------------------------------------------------
data_directory = '/var/lib/postgresql/17/main'
hba_file = '/etc/postgresql/17/main/pg_hba.conf'
ident_file = '/etc/postgresql/17/main/pg_ident.conf'
external_pid_file = '/var/run/postgresql/17-main.pid'
data_directory = '/var/lib/postgresql/$ver/main'
hba_file = '/etc/postgresql/$ver/main/pg_hba.conf'
ident_file = '/etc/postgresql/$ver/main/pg_ident.conf'
external_pid_file = '/var/run/postgresql/$ver-main.pid'
#------------------------------------------------------------------------------
# CONNECTIONS AND AUTHENTICATION
@@ -92,7 +94,7 @@ log_timezone = 'Etc/UTC'
# PROCESS TITLE
#------------------------------------------------------------------------------
cluster_name = '17/main'
cluster_name = '$ver/main'
#------------------------------------------------------------------------------
# CLIENT CONNECTION DEFAULTS