[stable-only] Update system locale before PostgreSQL initialization

In Fedora/CentOS9, the PostgreSQL initialization fails with the
following message:
  initdb: invalid locale settings; check LANG and LC_* environment
  variables

This patch installs the required packages and configure the system
locale before calling the initialization process.

Closes-Bug: #2083482
Change-Id: I2c83e896819b20cd7a1ee8d8ee33354fb047a6d9
This commit is contained in:
Rodolfo Alonso Hernandez
2024-10-02 09:36:55 +00:00
parent c52f50ee8c
commit e42e6f31a6

View File

@@ -53,7 +53,8 @@ function configure_database_postgresql {
pg_hba=/var/lib/pgsql/data/pg_hba.conf
pg_conf=/var/lib/pgsql/data/postgresql.conf
if ! sudo [ -e $pg_hba ]; then
sudo postgresql-setup initdb
localectl set-locale LANG=en_US.UTF-8
sudo -E postgresql-setup initdb
fi
elif is_ubuntu; then
version=`psql --version | cut -d ' ' -f3 | cut -d. -f1-2`
@@ -108,7 +109,7 @@ EOF
if is_ubuntu; then
install_package postgresql
elif is_fedora || is_suse; then
install_package postgresql-server
install_package postgresql-server langpacks-en glibc-langpack-en
if is_fedora; then
sudo systemctl enable postgresql
fi