Create dsn.sh

This commit is contained in:
FusionPBX 2017-06-15 09:59:02 -07:00 committed by GitHub
parent 4dda1f6b36
commit a3c7e6a1a4
1 changed files with 12 additions and 2 deletions

View File

@ -14,14 +14,24 @@ if [ .$database_password = .'random' ]; then
read -p "Enter the database password: " database_password read -p "Enter the database password: " database_password
fi fi
#whether to load the schema
read -p "Auto create schemas (y/n): " auto_create_schema
#whether to load the schema
read -p "Load schema with primary keys (y/n): " load_schema
#set PGPASSWORD #set PGPASSWORD
export PGPASSWORD=$database_password export PGPASSWORD=$database_password
#disable auto create schemas #disable auto create schemas
sed -i /etc/freeswitch/autoload_configs/switch.conf.xml -e s:'<!-- <param name="auto-create-schemas" value="true"/> -->:<param name="auto-create-schemas" value="false"/>:' if [ .$auto_create_schema == ."n" ]; then
sed -i /etc/freeswitch/autoload_configs/switch.conf.xml -e s:'<!-- <param name="auto-create-schemas" value="true"/> -->:<param name="auto-create-schemas" value="false"/>:'
fi
#load the schema #load the schema
sudo -u postgres psql -d freeswitch -f /var/www/fusionpbx/resources/install/sql/switch.sql -L /tmp/schema.log; if [ .$load_schema == ."y" ]; then
sudo -u postgres psql -d freeswitch -f /var/www/fusionpbx/resources/install/sql/switch.sql -L /tmp/schema.log;
fi
#enable odbc-dsn in the xml #enable odbc-dsn in the xml
sed -i /etc/freeswitch/autoload_configs/db.conf.xml -e s:'<!--<param name="odbc-dsn" value="$${dsn}"/>-->:<param name="odbc-dsn" value="$${dsn}"/>:' sed -i /etc/freeswitch/autoload_configs/db.conf.xml -e s:'<!--<param name="odbc-dsn" value="$${dsn}"/>-->:<param name="odbc-dsn" value="$${dsn}"/>:'