changeset 5292:3dc4c2798212

merge
author Tom Gottfried <tom@intevation.de>
date Thu, 14 Mar 2013 12:30:22 +0100
parents 66d9389c80cb (current diff) f6478773a5bb (diff)
children 8aae8c26844f
files flys-backend/doc/schema/postgresql-spatial.sql
diffstat 1 files changed, 10 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/flys-backend/doc/schema/postgresql-setup.sh	Thu Mar 14 12:16:58 2013 +0100
+++ b/flys-backend/doc/schema/postgresql-setup.sh	Thu Mar 14 12:30:22 2013 +0100
@@ -1,6 +1,8 @@
 #!/bin/bash
-# $1: user name for new DB
+
+# $1: user name and password for new DB (equals DB name)
 # $2: path to directory with schema-scripts
+# $3: host
 
 # run as user postgres (postgresql super-user)
 # it is assumed that the owner of the DB has the same name as the DB!
@@ -9,9 +11,10 @@
 createuser -S -D -R $1
 createdb $1
 createlang plpgsql $1
-psql -d $1 -f /usr/share/postgresql/contrib/postgis-1.5/postgis.sql
-psql -d $1 -f /usr/share/postgresql/contrib/postgis-1.5/spatial_ref_sys.sql
-psql -d $1 -c "ALTER USER $1 PASSWORD $1;"
+# Appears e.g. as /usr/share/postgresql/contrib/postgis-1.5/ on other systems.
+psql -d $1 -f /usr/share/postgresql/8.4/contrib/postgis-1.5/postgis.sql
+psql -d $1 -f /usr/share/postgresql/8.4/contrib/postgis-1.5/spatial_ref_sys.sql
+psql -d $1 -c "ALTER USER $1 WITH PASSWORD '$1';"
 psql -d $1 -c "GRANT ALL ON geometry_columns TO $1; GRANT ALL ON geography_columns TO $1; GRANT ALL ON spatial_ref_sys TO $1;"
 
 # add credentials to .pgpass (or create .pgpass)
@@ -19,6 +22,6 @@
 chmod 0600 ~/.pgpass
 
 # apply schema-scripts
-psql -d $1 -U $1 -h $HOST -f $2/postgresql.sql
-psql -d $1 -U $1 -h $HOST -f $2/postgresql-spatial.sql
-psql -d $1 -U $1 -h $HOST -f $2/postgresql-minfo.sql
+psql -d $1 -U $1 -h $3 -f $2/postgresql.sql
+psql -d $1 -U $1 -h $3 -f $2/postgresql-spatial.sql
+psql -d $1 -U $1 -h $3 -f $2/postgresql-minfo.sql

http://dive4elements.wald.intevation.org