-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
copy environment init to its own file
- copy it into image at a specific root location - source it in /etc/skel/.profile so it appears in default denv use - source it in /etc/entry.sh so it is still used in ldmx use
- Loading branch information
1 parent
7db19f6
commit cb7d8ad
Showing
3 changed files
with
88 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
#!/bin/bash | ||
|
||
############################################################################### | ||
# Environment initialization for LDMX SW container images | ||
# Assumptions: | ||
# - The installation location of ldmx-sw is defined in LDMX_SW_INSTALL | ||
# or it is located at LDMX_BASE/ldmx-sw/install. | ||
############################################################################### | ||
|
||
# add ldmx-sw and ldmx-analysis installs to the various paths | ||
# LDMX_SW_INSTALL is defined when building the production image or users | ||
# can use it to specify a non-normal install location | ||
if [ -z "${LDMX_SW_INSTALL}" ]; then | ||
export LDMX_SW_INSTALL=$LDMX_BASE/ldmx-sw/install | ||
fi | ||
export LD_LIBRARY_PATH=$LDMX_SW_INSTALL/lib:$LD_LIBRARY_PATH | ||
export PYTHONPATH=$LDMX_SW_INSTALL/python:$LDMX_SW_INSTALL/lib:$PYTHONPATH | ||
export PATH=$LDMX_SW_INSTALL/bin:$PATH | ||
|
||
#add what we need for GENIE | ||
export LD_LIBRARY_PATH=$GENIE/lib:/usr/local/pythia6:$LD_LIBRARY_PATH | ||
export PATH=$GENIE/bin:$PATH | ||
|
||
# add externals installed along side ldmx-sw | ||
# WARNING: No check to see if there is anything in this directory | ||
for _external_path in $LDMX_SW_INSTALL/external/*/lib | ||
do | ||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$_external_path | ||
done | ||
unset _external_path | ||
|
||
# Developer option: If a custom geant4 install is to be used, source the | ||
# environment script from that install | ||
# | ||
# Note: Use with care! | ||
# | ||
# The custom Geant4 install still needs to have been built with the same | ||
# container environment | ||
if [ -n "${LDMX_CUSTOM_GEANT4+x}" ]; then | ||
# Overly obnoxious warning to make sure this feature isn't used accidentally | ||
# Also detail how to set custom Geant4 data directories | ||
if [ -z "${LDMX_CUSTOM_GEANT4_CONFIRM_DEV+x}" ]; then | ||
echo "Warning: You are relying on a non-container version of Geant4. This mode of operation can come with some reproducibility concerns if you aren't careful. " | ||
echo "Define the environment variable LDMX_CUSTOM_GEANT4_CONFIRM_DEV in the container environment to suppress this message" | ||
echo "If using the standard ldmx-env.sh shell script, use 'ldmx setenv' to set environment variables within the container environment" | ||
echo "You may also want to define LDMX_CUSTOM_GEANT4_DATA_DIR if you are using a version of Geant4 different from 10.2.3 and the Geant4 build you intend to use has the data directory in an non-standard location (i.e. one that isn't picked up by the geant4.sh script) " | ||
fi | ||
# First: Unset the container-specific versions of the Geant4 data directories | ||
unset G4NEUTRONHPDATA | ||
unset G4LEDATA | ||
unset G4LEVELGAMMADATA | ||
unset G4RADIOACTIVEDATA | ||
unset G4PARTICLEXSDATA | ||
unset G4PIIDATA | ||
unset G4REALSURFACEDATA | ||
unset G4SAIDXSDATA | ||
unset G4ABLADATA | ||
unset G4INCLDATA | ||
unset G4ENSDFSTATEDATA | ||
unset G4NEUTRONXSDATA | ||
# If explicitly requested, use a custom location for Geant4's data directories | ||
if [ -n "${LDMX_CUSTOM_GEANT4_DATA_DIR+x}" ]; then | ||
export GEANT4_DATA_DIR=$LDMX_CUSTOM_GEANT4_DATA_DIR | ||
fi | ||
# Source the custom geant's environment script | ||
source $LDMX_CUSTOM_GEANT4/bin/geant4.sh | ||
# Prioritize the cmake config in the Geant4 installation over the container location (/usr/local) | ||
export CMAKE_PREFIX_PATH=$LDMX_CUSTOM_GEANT4/lib/cmake:/usr/local/:$CMAKE_PREFIX_PATH | ||
|
||
# If no directory was found by the geant4.sh script and the user didn't | ||
# explicitly ask for a location (e.g. for a debug build): | ||
# | ||
# Assume we are using 10.2.3 (container provided) data | ||
if [ -z "$GEANT4_DATA_DIR" ]; then | ||
export GEANT4_DATA_DIR=${G4DATADIR} | ||
fi | ||
else | ||
# Tell CMake to look for configuration files in the container location by default | ||
export CMAKE_PREFIX_PATH=/usr/local/:$LDMX_SW_INSTALL | ||
fi |