echo "Please, enter username for postgresql user"
read UNAME
echo "Please, enter Password for postgresql user"
read PASSWORD
echo "Please enter Database Name for gnowsys-pg database"
read DBNAME
echo "Please enter the ip of your postgresql database"
echo "Type localhost if you are in doubt"
read IP

expect -c "
spawn createuser -s $UNAME -P
expect {
"Enter*:" { send \"$PASSWORD\r\"; exp_continue }
Enter it again: { send \"$PASSWORD\r\"; exp_continue }
}
echo "Please wait ..." 
exit
"

/opt/Plone-2.5.2/Python-2.4.5/bin/python /tmp/gnowsys-pg/genSchema.py -g $DBNAME $IP $UNAME $PASSWORD 


touch /tmp/gnowsyspgadmin.txt
touch /tmp/DB_connectionString.txt


echo "The username of the Postgresql user is $UNAME" >> /tmp/gnowsyspgadmin.txt
echo "The Password of the Postgresql user is $PASSWORD" >> /tmp/gnowsyspgadmin.txt 
echo "The Database Name for gnowsys-pg database is $DBNAME" >> /tmp/gnowsyspgadmin.txt
echo "The ip of your postgresql database server is $IP" >> /tmp/gnowsyspgadmin.txt
echo "dbname=$DBNAME:user=$UNAME:password=$PASSWORD:host=$IP:port=5432" > /tmp/DB_connectionString.txt


