mirror of
https://github.com/raspiblitz/raspiblitz.git
synced 2025-11-19 02:22:24 +01:00
Compare commits
2 Commits
v1.11
...
4893-postg
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
be01bee97f | ||
|
|
f38b3834ff |
@@ -62,7 +62,7 @@ if [ "$command" = "1" ] || [ "$command" = "on" ]; then
|
||||
sudo chown -R postgres:postgres $postgres_datadir
|
||||
|
||||
echo "# Create cluster"
|
||||
sudo pg_createcluster $PG_VERSION main
|
||||
sudo pg_createcluster --locale en_US.UTF-8 $PG_VERSION main
|
||||
sudo pg_ctlcluster $PG_VERSION main start
|
||||
|
||||
elif [ -d /mnt/hdd/app-data/postgresql/$PG_VERSION/main ]; then
|
||||
@@ -79,12 +79,12 @@ if [ "$command" = "1" ] || [ "$command" = "on" ]; then
|
||||
echo "# Create $PG_VERSION config"
|
||||
sudo mkdir -p $postgres_datadir/$PG_VERSION/main
|
||||
sudo chown -R postgres:postgres $postgres_datadir
|
||||
sudo pg_createcluster $PG_VERSION main
|
||||
sudo pg_createcluster --locale en_US.UTF-8 $PG_VERSION main
|
||||
sudo pg_ctlcluster $PG_VERSION main start
|
||||
echo "Setting default password for postgres user"
|
||||
# start cluster temporarily
|
||||
sudo systemctl start postgresql
|
||||
sudo pg_createcluster $PG_VERSION main
|
||||
sudo pg_createcluster --locale en_US.UTF-8 $PG_VERSION main
|
||||
sudo pg_ctlcluster $PG_VERSION main start
|
||||
echo "Setting default password for postgres user"
|
||||
sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD 'postgres';"
|
||||
@@ -108,7 +108,7 @@ if [ "$command" = "1" ] || [ "$command" = "on" ]; then
|
||||
sudo chown -R postgres:postgres $postgres_datadir
|
||||
sudo systemctl start postgresql
|
||||
sudo systemctl start postgresql@13-main
|
||||
sudo pg_createcluster $PG_VERSION main
|
||||
sudo pg_createcluster --locale en_US.UTF-8 $PG_VERSION main
|
||||
sudo pg_ctlcluster $PG_VERSION main start
|
||||
|
||||
elif [ -d /mnt/hdd/app-data/postgresql/13/main ]; then
|
||||
@@ -130,7 +130,7 @@ if [ "$command" = "1" ] || [ "$command" = "on" ]; then
|
||||
sudo chown -R postgres:postgres $postgres_datadir
|
||||
# start cluster temporarily
|
||||
sudo systemctl start postgresql
|
||||
sudo pg_createcluster 13 main
|
||||
sudo pg_createcluster --locale en_US.UTF-8 13 main
|
||||
sudo pg_ctlcluster 13 main start
|
||||
echo "# Setting default password for postgres user"
|
||||
sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD 'postgres';"
|
||||
@@ -154,7 +154,7 @@ if [ "$command" = "1" ] || [ "$command" = "on" ]; then
|
||||
sudo chown -R postgres:postgres $postgres_datadir
|
||||
sudo systemctl start postgresql
|
||||
sudo systemctl start postgresql@13-main
|
||||
sudo pg_createcluster 13 main
|
||||
sudo pg_createcluster --locale en_US.UTF-8 13 main
|
||||
sudo pg_ctlcluster 13 main start
|
||||
|
||||
if [ -d /mnt/hdd/app-data/postgresql/$PG_VERSION ] || pg_lsclusters | grep -q "$PG_VERSION main"; then
|
||||
@@ -185,6 +185,24 @@ if [ "$command" = "1" ] || [ "$command" = "on" ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
# Setting PostgreSQL locale settings
|
||||
LOCALE_SETTINGS=(
|
||||
"lc_messages = 'en_US.UTF-8'"
|
||||
"lc_monetary = 'en_US.UTF-8'"
|
||||
"lc_numeric = 'en_US.UTF-8'"
|
||||
"lc_time = 'en_US.UTF-8'"
|
||||
)
|
||||
for setting in "${LOCALE_SETTINGS[@]}"; do
|
||||
key=$(echo "$setting" | cut -d= -f1 | tr -d ' ')
|
||||
if ! sudo grep -q "^${key}" /etc/postgresql/$PG_VERSION/main/postgresql.conf; then
|
||||
echo "# Adding $setting"
|
||||
echo "$setting" | sudo tee -a /etc/postgresql/$PG_VERSION/main/postgresql.conf
|
||||
else
|
||||
echo "# Updating $setting"
|
||||
sudo sed -i "s|^${key}.*|${setting}|" /etc/postgresql/$PG_VERSION/main/postgresql.conf
|
||||
fi
|
||||
done
|
||||
|
||||
# start cluster
|
||||
sudo systemctl enable postgresql
|
||||
sudo systemctl start postgresql
|
||||
|
||||
Reference in New Issue
Block a user