From d89b0435af2f860155657e2522e5918e33616dc5 Mon Sep 17 00:00:00 2001 From: Piotr Gawron <piotr.gawron@uni.lu> Date: Mon, 20 May 2019 16:07:26 +0200 Subject: [PATCH] when db configuration is cancelled don't create config file --- debian/template/postinst | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/debian/template/postinst b/debian/template/postinst index d1dddac06e..3540f506b4 100644 --- a/debian/template/postinst +++ b/debian/template/postinst @@ -46,16 +46,20 @@ case "$1" in . /etc/minerva/db.sh - if [ -z "$dbport" ] - then - dbport=5432 - fi + # when configuration was cancelled don't create config file + if [ ! -z "$dbuser" ] + then + if [ -z "$dbport" ] + then + dbport=5432 + fi - #create db configuration file - echo "database.uri=jdbc:postgresql://$dbserver:$dbport/$dbname" > /etc/minerva/db.properties - echo "database.username=$dbuser" >> /etc/minerva/db.properties - echo "database.password=$dbpass" >> /etc/minerva/db.properties + #create db configuration file + echo "database.uri=jdbc:postgresql://$dbserver:$dbport/$dbname" > /etc/minerva/db.properties + echo "database.username=$dbuser" >> /etc/minerva/db.properties + echo "database.password=$dbpass" >> /etc/minerva/db.properties + fi rm /etc/minerva/db.sh #we have to restart tomcat, because application was started on the old database and it might crash during deployment -- GitLab