epicslogin.sh
script installation script - Just the code
# Allow use of EPICS installations (to deny: comment out with leading '#')
export ALLOW_USE_OF_EPICS_GSI_INSTALL=true;
# Definitions:
[ 'true' == "$ALLOW_USE_OF_EPICS_GSI_INSTALL" ] && export GSI_EPICS_INSTALLATIONS_TOP_DIR=~epics
# Change to directory %EPICSBASE_MYHOMEDIR%/bin
%CD_CMD% %EPICSBASE_MYHOMEDIR% || %DIE_CMD%;
# define list of scripts to be looked for
list=epicslogin.sh
list="${list} fcn_addtopath.bash uniqpaths"
# Process for each item in list
%FOR_CMD% item in ${list}
do
%IF_CMD% [ 'true' = "$ALLOW_USE_OF_EPICS_GSI_INSTALL" ]
%THEN_CMD%
%IF_CMD% [ -f %GSI_EPICS_INSTALLATIONS_TOP_DIRECTORY_VAR%/bin/${item} ];
%THEN_CMD%
%LN_CMD% %GSI_EPICS_INSTALLATIONS_TOP_DIRECTORY_VAR%/bin/${item};
%FI_CMD%
%ELIF_CMD% [ -f ${%EPICS_ALL_EPICS_TOP_DIR_NAME%}/bin/${item} ];
%THEN_CMD%
%LN_CMD% ${%EPICS_ALL_EPICS_TOP_DIR_NAME%}/bin/${item};
%ELSE_CMD%
%MKDIR_CMD% %EPICS_DOWNLOAD_DIR%/bin &&
%CD_CMD% %EPICS_DOWNLOAD_DIR%/bin &&
%WGET_CMD% https://wiki.gsi.de/pub/Epics/EpicsInstallationsAtGsiBaseEpicsLoginShScriptInstallationScriptMainCode/${item};
doLocalCopy=false;
lookup=$(%WHICH_CMD% ${item})
%IF_CMD% [ ! -z "${lookup}" ]
%THEN_CMD%
%DIFF_CMD% %EPICS_DOWNLOAD_DIR%/bin/${item} ${lookup} > /dev/null
%IF_CMD% [ 0 -eq $? ]
%THEN_CMD%
%LN_CMD% ${lookup} %EPICSBASE_MYHOMEDIR%
doLocalCopy=false
%FI_CMD%
%ELSE_CMD%
doLocalCopy=true;
%FI_CMD%
%IF_CMD% [ "true" = "$doLocalCopy" ]
%THEN_CMD%
%CP_CMD% %EPICS_DOWNLOAD_DIR%/bin/${item} %EPICSBASE_MYHOMEDIR%
%ELSE_CMD%
%RM_CMD% %EPICS_DOWNLOAD_DIR%/bin/${item}
%FI_CMD%
%FI_CMD%
done
%UNSET_CMD% item lookup list doLocalCopy
%CD_CMD% %EPICSBASE_MYHOMEDIR% || %DIE_CMD%;