Print

Print


Commit in SlacMCPrj/scripts on MAIN
run-slic.sh+41-71.5 -> 1.6
JM: Make the slic run script use a few different variables to find the slic executable or run script.

SlacMCPrj/scripts
run-slic.sh 1.5 -> 1.6
diff -u -r1.5 -r1.6
--- run-slic.sh	16 Sep 2006 02:07:58 -0000	1.5
+++ run-slic.sh	28 Nov 2006 23:28:42 -0000	1.6
@@ -1,17 +1,51 @@
 #!/bin/sh
 
-slic_run=$PRJ_DIST/SimDist/pro/scripts/slic.sh
+#
+# A script for running slic in the SLAC linux environment.
+#
 
-if [ -n "${SLIC_BASE}" ]; then
-  slic_run=${SLIC_BASE}/bin/Linux-g++/slic 
+# Assume Linux.
+G4SYSTEM=Linux-g++
+
+# SLIC_BIN
+if [ -n "$SLIC_BIN" ]; then
+    echo "slic from SLIC_BIN=$SLIC_BIN in environment."
+    slic_run=$SLIC_BIN
+# SLIC_BASE
+elif [ -n "$SLIC_BASE" ]; then
+    echo "slic from SLIC_BASE=$SLIC_BASE directory in environment."
+    slic_run=$SLIC_BASE/bin/$G4SYSTEM/slic 
+# From default project location using SimDist.    
+else
+    echo "slic from default location at $PRJ_DIST/SimDist/pro/scripts/slic.sh"
+    slic_run=$PRJ_DIST/SimDist/pro/scripts/slic.sh
+fi
+
+# Check if binary exists.
+if [ ! -e "$slic_run" ]; then
+    echo "ERROR: $slic_run does not exist!"
+    exit 1
 fi
 
-#if [ -z "${G4SYSTEM}" ]; then
-#  echo "ERROR: G4SYSTEM is not set."
-#fi
+# Make sure it isn't a directory.
+if [ -d "$slic_run" ]; then
+    echo "ERROR: $slic_run is a directory, not an executable!"
+    exit 1
+fi
 
+# Make sure it is executable.
+if [ ! -x "$slic_run" ]; then
+    echo "ERROR: $slic_run is not executable!"
+    exit 1 
+fi
+
+# Setup Geant4 data.
 source setup-geant4-data.sh
 
+# Setup Coin, in case Geant4 was built with Inventor.
+source setup-coin.sh
+
 echo "Executing $slic_run ..."
 
-exec $slic_run $@
+# Run slic.
+$slic_run $@
CVSspam 0.2.8