From 332e4d0186e61e3d4b8ce5c915cbd422d30d8b47 Mon Sep 17 00:00:00 2001
From: Thomas Juerges <203795-tjuerges@users.noreply.gitlab.com>
Date: Wed, 19 May 2021 23:17:41 +0200
Subject: [PATCH] L2SS-124  Fix the bug in lofar20rc.sh

The script can now locate itself and set LOFAR20_DIR accordingly.
This allows for multiple installations in parallel.
---
 bootstrap/etc/lofar20rc.sh | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/bootstrap/etc/lofar20rc.sh b/bootstrap/etc/lofar20rc.sh
index e3c75df48..f9f87d6df 100755
--- a/bootstrap/etc/lofar20rc.sh
+++ b/bootstrap/etc/lofar20rc.sh
@@ -1,3 +1,4 @@
+#! /usr/bin/env bash -e
 # Set up the LOFAR2.0 environment.
 # For the time being it is assumend that the LOFAR2.0 environment has to
 # co-exist with a LOFAR1 environment.
@@ -6,9 +7,10 @@
 # And export those directories for LOFAR in Tango Docker images.
 
 # Pass a directory as first parameter to this script.  This will
-# then be used as LOFAR20_DIR.  Otherwise the current directory will
-# be used.
-export LOFAR20_DIR=${1:-${PWD}}
+# then be used as LOFAR20_DIR.  Otherwise this file's directory
+# be used to determine the tango directory location.
+ABSOLUTE_PATH=$(realpath $(dirname ${BASH_SOURCE}))
+export LOFAR20_DIR=${1:-$(realpath ${ABSOLUTE_PATH}/../..)}
 
 # This needs to be modified for a development environment.
 # Example:  ~/lofar2.0/tango
-- 
GitLab