diff schema/install-db.sh @ 1109:74a75a5ce770

Added geonames data and extended search for villages/cities. The free data from geonames https://download.geonames.org/ is imported into the gemma data base (for the relevant states) and used to search for cities and villages. This data might be replaced by data from the RIS-index later on..?
author Sascha Wilde <wilde@intevation.de>
date Mon, 05 Nov 2018 13:07:16 +0100
parents d1fb2babaa95
children ed8fbbc48440
line wrap: on
line diff
--- a/schema/install-db.sh	Fri Nov 02 17:21:33 2018 +0100
+++ b/schema/install-db.sh	Mon Nov 05 13:07:16 2018 +0100
@@ -15,6 +15,7 @@
   -p, --port=PORT  connect do the postgresql cluster at PORT.
                    Default is the postgresql standard port 5432
   -D, --demo       also install demo accounts and data
+  -G, --geonames   also import geonames data
       --adminpw    set the password to use for the "sysadmin" account.
                    Default is a random password.
       --metapw     set the password to use for the "meta_login" account.
@@ -43,6 +44,7 @@
 db=gemma
 port=5432
 demo=0
+geonames=0
 drop=0
 adminpw=`genpw 15`
 metapw=`genpw 15`
@@ -50,8 +52,8 @@
 # Parse options:
 
 OPTS=`getopt \
-      -l help,demo,db:,port:,drop,adminpw:,metapw: \
-      -o Dd:p: -n "$ME" -- "$@"`
+      -l help,demo,geonames,db:,port:,drop,adminpw:,metapw: \
+      -o DGd:p: -n "$ME" -- "$@"`
 [ $? -eq 0 ] || { usage ; exit 1 ; }
 
 eval set -- "$OPTS"
@@ -78,6 +80,10 @@
       demo=1
       shift 1
       ;;
+    --geonames|-G)
+      geonames=1
+      shift 1
+      ;;
     --drop)
       drop=1
       shift 1
@@ -103,10 +109,13 @@
        -c "SET client_min_messages TO WARNING;" \
        -f "$BASEDIR/isrs.sql" \
        -f "$BASEDIR/gemma.sql" \
+       -f "$BASEDIR/search.sql" \
+       -f "$BASEDIR/geonames.sql" \
        -f "$BASEDIR/manage_users.sql" \
        -f "$BASEDIR/auth.sql" \
        -f "$BASEDIR/default_sysconfig.sql"
 
+
   # setup initial login roles with given passwords:
   psql -qt -P pager=off -p "$port" -d "$db" \
        -v adminpw="$adminpw" -v metapw="$metapw" \
@@ -118,7 +127,10 @@
          -f "$BASEDIR/demo-data/users.sql" -d "$db"
     psql -q -p "$port" -f "$BASEDIR/demo-data/roles.sql" \
          -d "$db"
+  fi
 
+  if [[ $geonames -eq 1 ]] ; then
+    "$BASEDIR/geonames-import/import-geonames.sh" -p "$port" -d "$db"
   fi
 
 else