From 99eeaa13cfe13b897a9d43e7db4fd871d9042e74 Mon Sep 17 00:00:00 2001 From: Mark J Crane Date: Thu, 30 Mar 2017 21:41:35 +0000 Subject: [PATCH] Add creat role and permissions --- debian/resources/postgresql/bdr.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/debian/resources/postgresql/bdr.sh b/debian/resources/postgresql/bdr.sh index a91451f..b37162f 100755 --- a/debian/resources/postgresql/bdr.sh +++ b/debian/resources/postgresql/bdr.sh @@ -9,6 +9,7 @@ cd "$(dirname "$0")" #set the date now=$(date +%Y-%m-%d) +#set the database password if [ .$database_password = .'random' ]; then database_password=$(dd if=/dev/urandom bs=1 count=20 2>/dev/null | base64 | sed 's/[=\+//]//g') fi @@ -94,6 +95,13 @@ cd /tmp sudo -u postgres psql -c "CREATE DATABASE fusionpbx;"; sudo -u postgres psql -c "CREATE DATABASE freeswitch;"; +#add the users and grant permissions +sudo -u postgres psql -c "CREATE ROLE fusionpbx WITH SUPERUSER LOGIN PASSWORD '$database_password';" +sudo -u postgres psql -c "CREATE ROLE freeswitch WITH SUPERUSER LOGIN PASSWORD '$database_password';" +sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE fusionpbx to fusionpbx;" +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;" + #add the postgres extensions sudo -u postgres psql -d fusionpbx -c "CREATE EXTENSION btree_gist;"; sudo -u postgres psql -d fusionpbx -c "CREATE EXTENSION bdr;";