# HG changeset patch # User Thomas Junk # Date 1533905382 -7200 # Node ID 367346975513bd16fcd8eeced7c3970e15b996ce # Parent 0a9aaf21f69fe2950c27d6a12b36a631cdf895c9# Parent 88aa790d143705bc70842d462c5b1a3e65ac00a5 merge diff -r 0a9aaf21f69f -r 367346975513 schema/install-db.sh --- 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 @@ -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"