From 4bb64d7abbb57cc7b1f8a2e12477cbb2669be869 Mon Sep 17 00:00:00 2001
From: "Hahn Axel (hahn)" <axel.hahn@iml.unibe.ch>
Date: Wed, 3 Nov 2021 10:51:39 +0100
Subject: [PATCH] finetune output on changed config file

---
 bin/create_config.sh | 5 +++--
 deploy_app.sh        | 1 +
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/bin/create_config.sh b/bin/create_config.sh
index 723c3e1..68ea058 100755
--- a/bin/create_config.sh
+++ b/bin/create_config.sh
@@ -131,11 +131,12 @@ echo
 echo --- Output file:
 bHasChanges=0
 if [ ! -f "${outfile}" ]; then
-    echo "File did not exist before: ${outfile} - creating it as a new file.">> ${cfgdiff} 
+    echo "${outfile} File did not exist before - creating it as a new file.">> ${cfgdiff}
     bHasChanges=1
 fi
 
-diff "${tmpfile}" "${outfile}" >> ${cfgdiff} 2>/dev/null || bHasChanges=1
+diff "${tmpfile}" "${outfile}" >/dev/null 2>/dev/null || bHasChanges=1
+diff "${tmpfile}" "${outfile}" | sed "s#^#${outfile} #g" >> ${cfgdiff} 2>/dev/null
 if [ $bHasChanges -eq 0 ]; then
     _warn "INFO: no changes in ${outfile}."
 else
diff --git a/deploy_app.sh b/deploy_app.sh
index a3cddce..54ed471 100755
--- a/deploy_app.sh
+++ b/deploy_app.sh
@@ -249,6 +249,7 @@ function deploy(){
     test $isupdate -eq 0 || run_task "${profiledir}/tasks_postinstall.sh"
     grep . $cfgdiff
     if [ $? -eq 0 ]; then
+        echo "INFO: a config file was created or changed."
         run_task "${profiledir}/tasks_postchange.sh"
     else
         echo SKIP: No config file was changed.
-- 
GitLab