Mercurial > gemma
changeset 377:220a893318fa
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.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Fri, 10 Aug 2018 13:36:24 +0200 |
parents | e42f42eb9353 |
children | 88aa790d1437 |
files | schema/install-db.sh |
diffstat | 1 files changed, 10 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- 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 <wilde@intevation.de> @@ -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"