changeset 6818:4ad2b530dbba double-precision

Make postgresql-setup helper script work on different platforms.
author Tom Gottfried <tom@intevation.de>
date Mon, 12 Aug 2013 18:14:12 +0200
parents 63a24b4fbebf
children 1d60614c1059
files backend/doc/schema/postgresql-setup.sh
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/backend/doc/schema/postgresql-setup.sh	Mon Aug 12 18:12:14 2013 +0200
+++ b/backend/doc/schema/postgresql-setup.sh	Mon Aug 12 18:14:12 2013 +0200
@@ -11,9 +11,12 @@
 createuser -S -D -R $1
 createdb $1
 createlang plpgsql $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
+# Path appears e.g. as /usr/share/postgresql/contrib/postgis-1.5/ on some systems,
+# /usr/share/postgresql/8.4/contrib/postgis-1.5/ on others
+POST_INIT_DIR=`find /usr/share/postgresql/ -name spatial_ref_sys.sql | sed -n '1p'`
+POST_INIT_DIR=`dirname $POST_INIT_DIR`
+psql -d $1 -f $POST_INIT_DIR/postgis.sql
+psql -d $1 -f $POST_INIT_DIR/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;"
 

http://dive4elements.wald.intevation.org