PageRenderTime 114ms CodeModel.GetById 107ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 1ms

/docs/ref/contrib/gis/create_template_postgis-debian.sh

https://code.google.com/p/mango-py/
Shell | 38 lines | 29 code | 5 blank | 4 comment | 10 complexity | 86c881183dd4c7f33432312d255488e5 MD5 | raw file
 1#!/bin/bash
 2
 3# For Ubuntu 8.x and 9.x releases.
 4if [ -d "/usr/share/postgresql-8.3-postgis" ]
 5then
 6    POSTGIS_SQL_PATH=/usr/share/postgresql-8.3-postgis
 7    POSTGIS_SQL=lwpostgis.sql
 8fi
 9
10# For Ubuntu 10.04
11if [ -d "/usr/share/postgresql/8.4/contrib" ]
12then
13    POSTGIS_SQL_PATH=/usr/share/postgresql/8.4/contrib
14    POSTGIS_SQL=postgis.sql
15fi
16
17# For Ubuntu 10.10 (with PostGIS 1.5)
18if [ -d "/usr/share/postgresql/8.4/contrib/postgis-1.5" ]
19then
20    POSTGIS_SQL_PATH=/usr/share/postgresql/8.4/contrib/postgis-1.5
21    POSTGIS_SQL=postgis.sql
22    GEOGRAPHY=1
23else
24    GEOGRAPHY=0
25fi
26
27createdb -E UTF8 template_postgis && \
28createlang -d template_postgis plpgsql && \
29psql -d postgres -c "UPDATE pg_database SET datistemplate='true' WHERE datname='template_postgis';" && \
30psql -d template_postgis -f $POSTGIS_SQL_PATH/$POSTGIS_SQL && \
31psql -d template_postgis -f $POSTGIS_SQL_PATH/spatial_ref_sys.sql && \
32psql -d template_postgis -c "GRANT ALL ON geometry_columns TO PUBLIC;" && \
33psql -d template_postgis -c "GRANT ALL ON spatial_ref_sys TO PUBLIC;"
34
35if ((GEOGRAPHY))
36then
37    psql -d template_postgis -c "GRANT ALL ON geography_columns TO PUBLIC;"
38fi