Skip to content
This repository has been archived by the owner on Aug 28, 2021. It is now read-only.

Commit

Permalink
Now the install script can change postgres's password.
Browse files Browse the repository at this point in the history
  • Loading branch information
lcoandrade committed Jan 19, 2016
1 parent c8c5d97 commit 5ff82c5
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 10 deletions.
20 changes: 17 additions & 3 deletions ManagementScripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ function configure_apache {
sudo /etc/init.d/apache2 restart
}

function configure_postgresql {
export PGPASSWORD=postgres
function configure_postgresql() {
export PGPASSWORD=$1
postgresqlfolder=$(psql -c 'show config_file' -U postgres -h localhost -p 5432 |grep postgresql.conf)
pghbafolder=$(psql -c 'show hba_file' -U postgres -h localhost -p 5432 |grep pg_hba.conf)
sudo sed -i "s/listen_addresses = 'localhost'/listen_addresses = '\*'/g" $postgresqlfolder
Expand All @@ -52,6 +52,11 @@ function configure_postgresql {
sudo /etc/init.d/postgresql restart
}

function alter_postgres_password() {
export PGPASSWORD=$1
psql -c "ALTER USER postgres WITH PASSWORD '$2'" -U postgres -h localhost -p 5432
}

function update_plugins {
#getting plugins latest tag html files
$WGET https://github.com/lcoandrade/DsgTools/releases/latest -O ~/lastestdsgtools.html
Expand Down Expand Up @@ -134,7 +139,16 @@ fi
echo "Configurar PostgresSQL? (s/n)"; read configurarpostgres
configurarpostgres="${configurarpostgres:=s}"
if [[ $configurarpostgres == [sS] ]]; then
configure_postgresql
echo "Entre com o password: "; read PASSWORD
configure_postgresql $PASSWORD
fi

echo "Alterar senha do usuário Postgres? (s/n)"; read alterarsenha
alterarsenha="${alterarsenha:=s}"
if [[ $alterarsenha == [sS] ]]; then
echo "Entre com o password atual: "; read PASSWORD
echo "Entre com o novo password: "; read NEWPASSWORD
alter_postgres_password $PASSWORD $NEWPASSWORD
fi

echo "Atualizar plugins? (s/n)"; read atualizarplugins
Expand Down
16 changes: 11 additions & 5 deletions ManagementScripts/teste.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
#!/bin/bash

#configuring postgresql network--------------------------------------------
echo "Teste? (s/n) "; read sim
sim="${sim:=s}"
echo $sim
if [ "$sim" == "s" ]; then
echo "SIM SIM"
function alter_postgres_password() {
export PGPASSWORD=$1
psql -c "ALTER USER postgres WITH PASSWORD '$2'" -U postgres -h localhost -p 5432
}

echo "Alterar senha do usuário Postgres? (s/n)"; read alterarsenha
alterarsenha="${alterarsenha:=s}"
if [[ $alterarsenha == [sS] ]]; then
echo "Entre com o password atual: "; read PASSWORD
echo "Entre com o novo password: "; read NEWPASSWORD
alter_postgres_password $PASSWORD $NEWPASSWORD
fi
#----------------installing and configuring packages--------------------------------------------

Expand Down
4 changes: 2 additions & 2 deletions plugins.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<plugins>
<pyqgis_plugin name="DsgManagementTools" version="1.1.5" plugin_id="1">
<pyqgis_plugin name="DsgManagementTools" version="1.2" plugin_id="1">
<description>Tools to manage DSG's cartographic production.></description>
<about>
DSGManagementTools with the followinf features -Replication of PostGIS databases created with the DsgTools plugin.
</about>
<version>1.1.5</version>
<version>1.2</version>
<qgis_minimum_version>2.6</qgis_minimum_version>
<qgis_maximum_version>2.99</qgis_maximum_version>
<homepage>https://github.com/phborba/DSGManagementTools></homepage>
Expand Down

0 comments on commit 5ff82c5

Please sign in to comment.