Skip to content

Commit

Permalink
Version error fix
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewQuijano committed Aug 26, 2024
1 parent e1511b7 commit c3ced89
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions scripts/setup_postgres.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@ if [ $EUID -ne 0 ]; then
fi

PGPASS="${HOME}/.pgpass"
PG_VERSION=$(psql --version | awk '{print $3}' | cut -d '.' -f 1)

if [ ! -f "${PGPASS}" ]; then
postgres_depends=$(dpkg-query -W -f='${depends}' 'postgresql')
postgres_pkg=$(echo "${postgres_depends}" | grep -oP 'postgresql-[0-9]+.?[0-9]+')
postgres_version=${postgres_pkg/postgresql-/}
pg_hba="/etc/postgresql/${postgres_version}/main/pg_hba.conf"
pg_hba="/etc/postgresql/${PG_VERSION}/main/pg_hba.conf"
postgres_password='postgrespostgres'

$SUDO sed -i.bak -E 's/^(local\s+all\s+postgres\s+)md5$/\1peer/' "${pg_hba}"
Expand All @@ -30,7 +28,7 @@ if [ ! -f "${PGPASS}" ]; then
fi

# Define the PostgreSQL version
PG_VERSION=$(psql --version | awk '{print $3}' | cut -d '.' -f 1)


# Define the configuration file paths
PG_CONF="/etc/postgresql/${PG_VERSION}/main/postgresql.conf"
Expand Down

0 comments on commit c3ced89

Please sign in to comment.