From afbff1bfdcfcdcb2f11838dac5dd9861cc3b108e Mon Sep 17 00:00:00 2001
From: Erik Kooistra <kooistra@astron.nl>
Date: Tue, 2 Sep 2014 08:55:52 +0000
Subject: [PATCH] Corrected check on run script only once.

---
 tools/modelsim/modelsim_version.sh |  6 ------
 tools/quartus/quartus_generic.sh   | 26 +++++++++++++++-----------
 tools/quartus/quartus_version.sh   |  6 ------
 3 files changed, 15 insertions(+), 23 deletions(-)

diff --git a/tools/modelsim/modelsim_version.sh b/tools/modelsim/modelsim_version.sh
index 7d9215fec0..50b10db2b3 100755
--- a/tools/modelsim/modelsim_version.sh
+++ b/tools/modelsim/modelsim_version.sh
@@ -20,10 +20,6 @@
 #
 ###############################################################################
 
-# Only run this script once
-if [ -z "${MODELSIM_VERSION_SH}" ]; then
-export MODELSIM_VERSION_SH=true
-
 MODELSIM_VERSION=${1}
 echo "Select Modelsim version: ${MODELSIM_VERSION}"
 
@@ -35,5 +31,3 @@ fi
 
 # Must not define MODEL_TECH, because it gets defined when the tool starts. Therefore define MODEL_TECH_DIR to denote the modeltech version directory
 export MODEL_TECH_DIR=/home/software/Mentor/${MODELSIM_VERSION_DIR}/modeltech
-
-fi
\ No newline at end of file
diff --git a/tools/quartus/quartus_generic.sh b/tools/quartus/quartus_generic.sh
index 2a62f439e0..059ec621ba 100755
--- a/tools/quartus/quartus_generic.sh
+++ b/tools/quartus/quartus_generic.sh
@@ -20,9 +20,10 @@
 #
 ###############################################################################
 
-# Only run this script once
+# Detect if this script has already ran once
 if [ -z "${QUARTUS_GENERIC_SH}" ]; then
-export QUARTUS_GENERIC_SH=true
+    export QUARTUS_GENERIC_SH=true
+fi
 echo "Run quartus_generic.sh"
 
 # Derive generic Quartus tool version related paths from $QUARTUS_DIR that gets defined in quartus_version.sh
@@ -32,18 +33,21 @@ export QUARTUS_ROOTDIR_OVERRIDE=${QUARTUS_DIR}/quartus
 export NIOSDIR=${QUARTUS_DIR}/nios2eds
 export SOPC_KIT_NIOS2=${NIOSDIR}
 
-# Add to the $PATH, therefor run this script only once to avoid double entries
-export PATH=${PATH}:\
-${QUARTUS_ROOTDIR}/bin:\
-${QUARTUS_ROOTDIR}/sopc_builder/bin:\
-${NIOSDIR}/bin:\
-${NIOSDIR}/bin/gnu/H-i686-pc-linux-gnu/bin:\
-${NIOSDIR}/sdk2/bin
+echo $QUARTUS_DIR
+echo $QUARTUS_ROOTDIR
+
+# Add to the $PATH, only once to avoid double entries
+if [ -z "${QUARTUS_GENERIC_SH}" ]; then
+    export PATH=${PATH}:\
+    ${QUARTUS_ROOTDIR}/bin:\
+    ${QUARTUS_ROOTDIR}/sopc_builder/bin:\
+    ${NIOSDIR}/bin:\
+    ${NIOSDIR}/bin/gnu/H-i686-pc-linux-gnu/bin:\
+    ${NIOSDIR}/sdk2/bin
+fi
 
 # Qsys
 export ALTERA_HW_TCL_KEEP_TEMP_FILES=1
 
 # User synthesis timestamp in FPGA image
 export UNB_COMPILE_STAMPS=1
-
-fi
\ No newline at end of file
diff --git a/tools/quartus/quartus_version.sh b/tools/quartus/quartus_version.sh
index 29a994c8ef..340411058c 100755
--- a/tools/quartus/quartus_version.sh
+++ b/tools/quartus/quartus_version.sh
@@ -20,10 +20,6 @@
 #
 ###############################################################################
 
-# Only run this script once
-if [ -z "${QUARTUS_VERSION_SH}" ]; then
-export QUARTUS_VERSION_SH=true
-
 QUARTUS_VERSION=${1}
 echo "Select Quartus version: ${QUARTUS_VERSION}"
 
@@ -32,5 +28,3 @@ export QUARTUS_DIR=/home/software/Altera/${QUARTUS_VERSION}
 
 # Select the path to the technology libraries that is used in the [libraries] section of the modelsim.ini
 export MODEL_TECH_ALTERA_LIB=/home/software/modelsim_altera_libs/${QUARTUS_VERSION}
-
-fi
\ No newline at end of file
-- 
GitLab