From b946bf5c98c0ccb4803caecad6525220360957cc Mon Sep 17 00:00:00 2001 From: mafoo Date: Fri, 3 Jun 2016 15:03:53 +0100 Subject: [PATCH] BugFix-suppress-error-in-psql --- debian/resources/postgres.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/debian/resources/postgres.sh b/debian/resources/postgres.sh index 8564762..e950f72 100755 --- a/debian/resources/postgres.sh +++ b/debian/resources/postgres.sh @@ -17,6 +17,9 @@ apt-get install -y --force-yes sudo postgresql #init.d #/usr/sbin/service postgresql restart +#move to /tmp to prevent a red herring error when running sudo with psql +cwd=$(pwd) +cd /tmp #add the databases, users and grant permissions to them sudo -u postgres psql -c "CREATE DATABASE fusionpbx"; sudo -u postgres psql -c "CREATE DATABASE freeswitch"; @@ -26,6 +29,7 @@ sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE fusionpbx to fusionpb sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE freeswitch to fusionpbx;" sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE freeswitch to freeswitch;" #ALTER USER fusionpbx WITH PASSWORD 'newpassword'; +cd $cwd #set the ip address server_address=$(hostname -I)