From 5f81003b45810ee18c10988366801e848aeed76c Mon Sep 17 00:00:00 2001
From: Eoin Clerkin <e.clerkin@ygsi.de>
Date: Wed, 9 Nov 2022 17:02:41 +0100
Subject: [PATCH] Append, overwrite and prepend in config script.

Makes clear to reader that append is default. Allows
previous overwrite option.
---
 cmake/scripts/config.sh.in | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/cmake/scripts/config.sh.in b/cmake/scripts/config.sh.in
index 4b939d17ad..86e8d4f2da 100644
--- a/cmake/scripts/config.sh.in
+++ b/cmake/scripts/config.sh.in
@@ -44,12 +44,19 @@ if [ $same_system -eq 1 ]; then
 			export LD_LIBRARY_PATH="@MY_LD_LIBRARY_PATH@":$LD_LIBRARY_PATH
 			export PATH="@MY_PATH@":$PATH
 			;;
+		-o | --overwrite )
+			for rc in /etc/profile $HOME/.bash_profiles; do echo "sourced ${rc}"; [ -f "${rc}" ] && source "${rc}"; done;
+			export DYLD_LIBRARY_PATH="@MY_DYLD_LIBRARY_PATH@"
+			export LD_LIBRARY_PATH="@MY_LD_LIBRARY_PATH@"
+                        export PATH=$PATH:"@MY_PATH@"
+			;;
 		* )
-                        echo "Default was changed"
-                        echo "Append new paths to LD_LIBRARY_PATH and PATH instead of overwritting"
+                        echo "To append use flag \"-a\". To overwrite use \"-o\". To prepend use \"-p\"."
+                        echo "Appended LD_LIBRARY_PATH and PATH by default."
                         export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:"@MY_DYLD_LIBRARY_PATH@"
                         export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"@MY_LD_LIBRARY_PATH@"
                         export PATH=$PATH:"@MY_PATH@"
 			;;
 	esac
+ 	echo "Configurated for CBMROOT at ${VMCWORKDIR}"
 fi
-- 
GitLab