Set up a shell with the environment
Source setEpicsEnv.bash from the top of an installed tree to point the
current Bash shell at that tree’s Experimental Physics and Industrial Control
System (EPICS) base, modules, and tools.
Prerequisites
- An installed tree built with
make installandmake symlinks; see Build and install the environment. The script puts thepvxsandpmactools onPATHthrough the unversioned module links thatmake symlinkscreates. perlonPATHfor automatic architecture detection, or a fallback architecture supplied as described in step 3.
-
Source the script of the installed tree:
source <installed_tree>/setEpicsEnv.bash<installed_tree>is the path thatmake print-INSTALL_LOCATION_EPICSprints in the EPICS-env clone that built the tree.The script prints a summary of the values it set, followed by the full
PATHandLD_LIBRARY_PATHand the lineEnjoy Everlasting EPICS!. The summary starts with these lines:Set the EPICS Environment as follows: THIS Source NAME : setEpicsEnv.bash THIS Source PATH : <installed_tree> EPICS_BASE : <installed_tree>/base EPICS_HOST_ARCH : linux-x86_64 EPICS_MODULES : <installed_tree>/modulesThe script derives every path from its own location, so it needs no edit when the tree moves. To select another installed version, source that tree’s setup script. No location or release argument is required. It exports these variables:
Variable Value EPICS_PATHThe directory that holds the script EPICS_BASE$EPICS_PATH/baseEPICS_MODULES$EPICS_PATH/modulesEPICS_HOST_ARCHThe detected architecture, such as linux-x86_64, or the supplied fallbackPATHPrepends modules/pmac/bin/<arch>,modules/pvxs/bin/<arch>, andbase/bin/<arch>LD_LIBRARY_PATHPrepends base/lib/<arch><arch>is the value ofEPICS_HOST_ARCH. WhenEPICS_BASEis set before you source the script, the script first printsEPICS_BASE is defined aswith that value. It then removes the entries of that tree fromPATHandLD_LIBRARY_PATHand adds the entries of the sourced tree. Sourcing a second tree therefore replaces the known base, pvxs, and pmac paths of the first. Removal compares complete colon-delimited entries. Unrelated entries retain their bytes and order, including duplicates and empty entries. Repeating setup adds each managed directory once.Setup preserves independent settings such as
EPICS_CA_ADDR_LISTandEPICS_CA_AUTO_ADDR_LIST. It also works with Bash nounset enabled byset -u, and preserves the caller’s directory, shell options, and positional arguments. -
Optional: to set the same variables without the printed summary, pass
disable:source <installed_tree>/setEpicsEnv.bash disableIn the shell of step 1,
EPICS_BASEis set, so the script prints the tree that it replaces, followed by two empty lines:EPICS_BASE is defined as <installed_tree>/baseIn a shell where
EPICS_BASEis not set, the script prints one empty line. -
Optional: supply a fallback architecture when Perl or the base discovery scripts are unavailable:
source <installed_tree>/setEpicsEnv.bash linux-x86_64 disableThe interface is
[<fallback_arch>] [disable]. Automatic detection takes priority over the fallback.disablecontrols only the summary. Invalid argument forms return status 2. If the script cannot determine its tree or architecture, it returns status 1 with a diagnostic and preserves the existing managed environment. A discovery command that fails returns status 1 before the script replaces that environment. -
Optional: remove the environment from the shell by sourcing the installed reset script:
source <installed_tree>/resetEpicsEnv.bashThe output names the tree it removes:
EPICS_BASE is defined as <installed_tree>/base Reset ...The script removes the
base,pvxs, andpmacentries fromPATH, thebaseentry fromLD_LIBRARY_PATH, and unsetsEPICS_PATH,EPICS_BASE,EPICS_HOST_ARCH, andEPICS_MODULES. It also removes the known legacy extension executable entry and unsetsEPICS_EXTENSIONS. Missing path components prevent removal of the corresponding entry; variable unsetting also runs when base is absent. Repeated reset succeeds.Reset preserves independent CA settings and other unmanaged EPICS variables.
install.baseinstalls both setup and reset with mode 0644.
Verification
-
Check that the shell finds the EPICS tools in the installed tree:
command -v softIoc caget pvget pvxgetEach tool resolves inside
<installed_tree>:<installed_tree>/base/bin/linux-x86_64/softIoc <installed_tree>/base/bin/linux-x86_64/caget <installed_tree>/base/bin/linux-x86_64/pvget <installed_tree>/modules/pvxs/bin/linux-x86_64/pvxget