[Git][noosfero/noosfero][master] 2 commits: noosfero-chat: avoid psql command if postgresql is not installed

Rodrigo Souto gitlab at mg.gitlab.com
Mon May 2 17:37:28 BRT 2016


Rodrigo Souto pushed to branch master at Noosfero / noosfero


Commits:
948cf621 by Rodrigo Souto at 2016-03-29T11:45:19-03:00
noosfero-chat: avoid psql command if postgresql is not installed

- - - - -
62193d8b by Rodrigo Souto at 2016-05-02T20:37:18+00:00
Merge branch 'noosfero-chat-db-dependency' into 'master'

noosfero-chat: avoid psql command if postgresql is not installed



See merge request !830
- - - - -


1 changed file:

- debian/noosfero-chat.postinst


Changes:

=====================================
debian/noosfero-chat.postinst
=====================================
--- a/debian/noosfero-chat.postinst
+++ b/debian/noosfero-chat.postinst
@@ -21,10 +21,17 @@ echo " [database = $noosfero_database]"
 echo 'Creating ejabberd schema ...'
 . /etc/default/noosfero
 noosfero_user="$NOOSFERO_USER"
-su - postgres -c "psql -c 'GRANT CREATE ON DATABASE $noosfero_database TO $noosfero_user;' > /dev/null"
+
+if dpkg -s postgresql &> /dev/null ; then
+  su - postgres -c "psql -c 'GRANT CREATE ON DATABASE $noosfero_database TO $noosfero_user;' > /dev/null"
+else
+  echo "[W]: No postgres installed. You're probably using noosfero's database in another machine. Make sure user $noosfero_user has CREATE permissions on $noosfero_database database by running:"
+  echo " => GRANT CREATE ON DATABASE $noosfero_database TO $noosfero_user;"
+fi
+
 su - $noosfero_user -c 'rails dbconsole production < /usr/share/noosfero/util/chat/postgresql/ejabberd.sql > /dev/null'
 
-if which update-noosfero-odbc > /dev/null ; then
+if which update-noosfero-odbc &> /dev/null ; then
   update-noosfero-odbc
 fi
 



View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/7b7390427eecb435b9168b6b6b88841e67bd6a75...62193d8b230da7ff83dd32c96efc462974b5c74b
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20160502/9c3ab538/attachment-0001.html>


More information about the Noosfero-dev mailing list