changeset 380:367346975513

merge
author Thomas Junk <thomas.junk@intevation.de>
date Fri, 10 Aug 2018 14:49:42 +0200
parents 0a9aaf21f69f (current diff) 88aa790d1437 (diff)
children 1cf1423d98e0
files
diffstat 1 files changed, 11 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/schema/install-db.sh	Fri Aug 10 14:49:29 2018 +0200
+++ b/schema/install-db.sh	Fri Aug 10 14:49:42 2018 +0200
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/bash -e
 # Author(s):
 # Sascha Wilde <wilde@intevation.de>
 
@@ -97,20 +97,23 @@
 
 if [[ drop -eq 0 ]] ; then
   # Default operation: create schema
-  psql -q -p "$port" -f "$BASEDIR/roles.sql"
   createdb -p "$port" "$db"
-  psql -qt -p "$port" -d "$db" \
+  psql -q -p "$port" -f "$BASEDIR/roles.sql" -d "$db"
+  psql -qtv ON_ERROR_STOP= -p "$port" -d "$db" \
        -c "SET client_min_messages TO WARNING;" \
        -f "$BASEDIR/gemma.sql" \
        -f "$BASEDIR/manage_users.sql" \
-       -f "$BASEDIR/auth.sql" \
+       -f "$BASEDIR/auth.sql"
+  psql -qt -p "$port" -d "$db" \
        -f "$BASEDIR/std_login_roles.sql"
 
   if [[ $demo -eq 1 ]] ; then
-    psql -q -p "$port" -f "$BASEDIR/demo-data/responsibility_areas.sql" \
+    psql -qv ON_ERROR_STOP= -p "$port" \
+         -f "$BASEDIR/demo-data/responsibility_areas.sql" \
+         -f "$BASEDIR/demo-data/users.sql" -d "$db"
+    psql -q -p "$port" -f "$BASEDIR/demo-data/roles.sql" \
          -d "$db"
-    psql -q -p "$port" -f "$BASEDIR/demo-data/roles.sql" \
-         -f "$BASEDIR/demo-data/users.sql" -d "$db"
+
   fi
   # set passwords:
   psql -qt -p "$port" -d "$db" \
@@ -121,7 +124,7 @@
   echo "Back end user 'gemma_service' created with password '$servicepw'."
 else
   # Evil mode: drop everything gemma
-  echo "Really drop database '$db' and alle gemma roles? [type 'yes']: "
+  echo "Really drop database '$db' and all gemma roles? [type 'yes']: "
   read a
   if [[ $a == "yes" ]] ; then
     dropdb -p "$port" "$db"