# HG changeset patch # User Tom Gottfried # Date 1376324052 -7200 # Node ID 4ad2b530dbba6d6b0ad7bbe32fcc76965945992a # Parent 63a24b4fbebf358eff98475683d05c50fcdafcfd Make postgresql-setup helper script work on different platforms. diff -r 63a24b4fbebf -r 4ad2b530dbba backend/doc/schema/postgresql-setup.sh --- 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;"