diff db_schema/setup-db.sh @ 1076:4ce4bd48c260

Avoid repeating potentially lengthy download of shapefiles.
author Tom Gottfried <tom@intevation.de>
date Fri, 30 Sep 2016 18:32:48 +0200
parents 299f4ba86090
children 1d1c50b7a23b
line wrap: on
line diff
--- a/db_schema/setup-db.sh	Fri Sep 30 17:41:31 2016 +0200
+++ b/db_schema/setup-db.sh	Fri Sep 30 18:32:48 2016 +0200
@@ -81,12 +81,15 @@
     echo create user $ROLE_NAME
     psql $DB_CONNECT_STRING -d $DB_NAME --command "CREATE SCHEMA geo AUTHORIZATION $ROLE_NAME"
 
-    TS="0101" 
+    TS="0101"
     cd /tmp
-    curl -O http://sg.geodatenzentrum.de/web_download/vg/vg250_${TS}/utm32s/shape/vg250_${TS}.utm32s.shape.ebenen.zip && \
+    if [ ! -f vg250_${TS}.utm32s.shape.ebenen.zip ]; then
+        curl -O \
+            http://sg.geodatenzentrum.de/web_download/vg/vg250_${TS}/utm32s/shape/vg250_${TS}.utm32s.shape.ebenen.zip
+    fi
     unzip vg250_${TS}.utm32s.shape.ebenen.zip "*VG250_GEM*"
     cd vg250_${TS}.utm32s.shape.ebenen/vg250_ebenen/
     shp2pgsql VG250_GEM geo.gem_utm | psql $DB_CONNECT_STRING -d $DB_NAME
     cd /tmp
-    rm -rf vg250_${TS}.utm32s.shape.ebenen*
+    rm -rf vg250_${TS}.utm32s.shape.ebenen
 fi
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)