mirror of
https://github.com/YunoHost-Apps/weblate_ynh.git
synced 2024-10-01 13:35:04 +02:00
Add postgres 9.6 support for stretch
This commit is contained in:
parent
ccf036ff23
commit
c0db10fa59
1 changed files with 13 additions and 1 deletions
|
@ -122,12 +122,24 @@ ynh_psql_test_if_first_run() {
|
||||||
echo "PostgreSQL is already installed, no need to create master password"
|
echo "PostgreSQL is already installed, no need to create master password"
|
||||||
else
|
else
|
||||||
pgsql=$(ynh_string_random)
|
pgsql=$(ynh_string_random)
|
||||||
|
pg_hba=""
|
||||||
echo "$pgsql" >> /etc/yunohost/psql
|
echo "$pgsql" >> /etc/yunohost/psql
|
||||||
|
|
||||||
|
if [ -e /etc/postgresql/9.4/ ]
|
||||||
|
then
|
||||||
|
pg_hba=/etc/postgresql/9.4/main/pg_hba.conf
|
||||||
|
elif [ -e /etc/postgresql/9.6/ ]
|
||||||
|
then
|
||||||
|
pg_hba=/etc/postgresql/9.6/main/pg_hba.conf
|
||||||
|
else
|
||||||
|
ynh_die "postgresql shoud be 9.4 or 9.6"
|
||||||
|
fi
|
||||||
|
|
||||||
systemctl start postgresql
|
systemctl start postgresql
|
||||||
su --command="psql -c\"ALTER user postgres WITH PASSWORD '${pgsql}'\"" postgres
|
su --command="psql -c\"ALTER user postgres WITH PASSWORD '${pgsql}'\"" postgres
|
||||||
# we can't use peer since YunoHost create users with nologin
|
# we can't use peer since YunoHost create users with nologin
|
||||||
sed -i '/local\s*all\s*all\s*peer/i \
|
sed -i '/local\s*all\s*all\s*peer/i \
|
||||||
local all all password' /etc/postgresql/9.4/main/pg_hba.conf
|
local all all password' "$pg_hba"
|
||||||
systemctl enable postgresql
|
systemctl enable postgresql
|
||||||
systemctl reload postgresql
|
systemctl reload postgresql
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue