Commit 948cf621ec20dda1fbc5847c4a0d29aed831849f
1 parent
723a6061
Exists in
staging
and in
31 other branches
noosfero-chat: avoid psql command if postgresql is not installed
Showing
1 changed file
with
9 additions
and
2 deletions
Show diff stats
debian/noosfero-chat.postinst
| ... | ... | @@ -21,10 +21,17 @@ echo " [database = $noosfero_database]" |
| 21 | 21 | echo 'Creating ejabberd schema ...' |
| 22 | 22 | . /etc/default/noosfero |
| 23 | 23 | noosfero_user="$NOOSFERO_USER" |
| 24 | -su - postgres -c "psql -c 'GRANT CREATE ON DATABASE $noosfero_database TO $noosfero_user;' > /dev/null" | |
| 24 | + | |
| 25 | +if dpkg -s postgresql &> /dev/null ; then | |
| 26 | + su - postgres -c "psql -c 'GRANT CREATE ON DATABASE $noosfero_database TO $noosfero_user;' > /dev/null" | |
| 27 | +else | |
| 28 | + 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:" | |
| 29 | + echo " => GRANT CREATE ON DATABASE $noosfero_database TO $noosfero_user;" | |
| 30 | +fi | |
| 31 | + | |
| 25 | 32 | su - $noosfero_user -c 'rails dbconsole production < /usr/share/noosfero/util/chat/postgresql/ejabberd.sql > /dev/null' |
| 26 | 33 | |
| 27 | -if which update-noosfero-odbc > /dev/null ; then | |
| 34 | +if which update-noosfero-odbc &> /dev/null ; then | |
| 28 | 35 | update-noosfero-odbc |
| 29 | 36 | fi |
| 30 | 37 | ... | ... |