forked from OSGeo/OSGeoLive
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_postgis.sh
executable file
·70 lines (57 loc) · 2.17 KB
/
install_postgis.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/sh
# Copyright (c) 2009-2018 The Open Source Geospatial Foundation and others.
# Licensed under the GNU LGPL version >= 2.1.
#
# This library is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 2.1 of the License,
# or any later version. This library is distributed in the hope that
# it will be useful, but WITHOUT ANY WARRANTY, without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU Lesser General Public License for more details, either
# in the "LICENSE.LGPL.txt" file distributed with this software or at
# web page "http://www.fsf.org/licenses/lgpl.html".
# About:
# =====
# This script will install postgres and postgis
#
./diskspace_probe.sh "`basename $0`" begin
BUILD_DIR=`pwd`
####
if [ -z "$USER_NAME" ] ; then
USER_NAME="user"
fi
USER_HOME="/home/$USER_NAME"
# Not to be confused with PGIS_Version, this has one less number and period
# to correspond to install paths
PG_VERSION="10"
apt-get install --yes postgis postgis-gui "postgresql-$PG_VERSION-postgis-2.4" "postgresql-$PG_VERSION-postgis-2.4-scripts"
if [ $? -ne 0 ] ; then
echo 'ERROR: Package install failed! Aborting.'
exit 1
fi
#enable gdal drivers
cat << EOF >> "/var/lib/postgresql/$PG_VERSION/main/postgresql.auto.conf"
## https://trac.osgeo.org/gdal/wiki/SecurityIssues
postgis.gdal_enabled_drivers = 'ENABLE_ALL'
postgis.enable_outdb_rasters = TRUE
EOF
## TODO review - needed for 1404 ?!
# fix for 2.1.1-1~precise3 package breakage
# rm -f /usr/share/java/postgis.jar
# ln -s /usr/share/java/postgis-jdbc-2.1.0~rc1.jar /usr/share/java/postgis.jar
#shp2pgsql-gui desktop launcher
cat << EOF > /usr/share/applications/shp2pgsql-gui.desktop
[Desktop Entry]
Type=Application
Name=shp2pgsql
Comment=Shapefile to PostGIS Import Tool
Categories=Application;Geography;Geoscience;
Exec=shp2pgsql-gui
Icon=pgadmin3
Terminal=false
EOF
cp -a /usr/share/applications/shp2pgsql-gui.desktop "$USER_HOME/Desktop/"
chown -R "$USER_NAME":"$USER_NAME" "$USER_HOME/Desktop/shp2pgsql-gui.desktop"
####
"$BUILD_DIR"/diskspace_probe.sh "`basename $0`" end