#!bin/sh
#
# script to build demonstration geodatabase on Linux (postgis > 1.0) 
#
echo -n "Enter a name for MDweb spatial database (for cartographic client support) : "
read database
echo -n "Enter the owner of the database (postgres user account with rights of DB creation) : "
read owner
echo -n "absolute path for lwpostgis.sql file (with lwpostgis.sql file in the path) : "
read lwpostgis_path
echo -n "absolute path for spatial_ref_sys.sql file (with spatial_ref_sys.sql file in the path) : "
read spatial_ref_sys_path
pg_dump -d $database > $database.sql
dropdb $database 
createdb -O  $owner $database -E LATIN1 -T template0
createlang plpgsql $database 
psql -d $database -f  $lwpostgis_path
psql -d $database -f $spatial_ref_sys_path
psql -d $database < dump-geo-demo15-linux.sql
