# HG changeset patch # User Tom Gottfried # Date 1533900984 -7200 # Node ID 220a893318fa711812d6a34b5402ae91add05c25 # Parent e42f42eb935333d38e117471f3ad84e2931e5eb8 Ignore only role creation errors in database setup To just keep on going in case of any error just produces lots of subsequent errors. Role creation, however, is expected to fail in case more than one database is created on the same cluster. diff -r e42f42eb9353 -r 220a893318fa schema/install-db.sh --- a/schema/install-db.sh Fri Aug 10 13:15:32 2018 +0200 +++ b/schema/install-db.sh Fri Aug 10 13:36:24 2018 +0200 @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -e # Author(s): # Sascha Wilde @@ -99,18 +99,21 @@ # Default operation: create schema psql -q -p "$port" -f "$BASEDIR/roles.sql" createdb -p "$port" "$db" - psql -qt -p "$port" -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"