Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-25 08:29:08

0001 if [ -z "$BASH_VERSION" ]; then
0002    echo "This script must be sourced in bash"
0003    return 1
0004 fi
0005 
0006 OS=$( hostnamectl | awk '/Operating System/{ print $3" "$4 }' )
0007 # if ! [[ "$OS" =~ "Alma" || "$OS" =~ "CentOS" || "$OS" =~ "Rocky" || "$OS" =~ "RHEL" || "$OS" =~ "Ubuntu" ]]; then
0008 #    echo "This script must be run on a supported OS"
0009 #    return 1
0010 # fi
0011 echo "Setting up sPHENIX Production for ${OS}"
0012 
0013 # This is the directory of the script (but no symlinks allowed)
0014 SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
0015 echo "Using scripts in sys: ${SCRIPT_DIR}"
0016 
0017 source /opt/sphenix/core/bin/sphenix_setup.sh -n new
0018 export PATH=${PATH}:${HOME}/bin:./bin
0019 export ODBCINI=./.odbc.ini
0020 
0021 export PYTHONPATH=${PYTHONPATH}:${SCRIPT_DIR}
0022 export PATH=${PATH}:${SCRIPT_DIR}
0023 
0024 echo Using $(python --version)
0025 
0026 set_bash_prompt() {
0027     #branch name
0028     local branch=$( git -C ${SCRIPT_DIR} rev-parse --abbrev-ref HEAD  2> /dev/null )
0029 
0030     local branch_color_status="\[\e[31m\]" # red is dangerous
0031     if [[ "$branch" == "main" ]] ; then
0032         branch_color_status="\[\e[34m\]" # Blue is safe (green (31) is ugly)
0033     fi
0034 
0035     # bold font if there are uncommitted changes
0036     if [ -n "$(git -C ${SCRIPT_DIR} status --porcelain -uno)" ]; then
0037         branch_color_status="${branch_color_status}\[\e[1m\]"
0038     fi
0039     PS1="\h:\w${branch_color_status} git:${branch}\[\e[0m\]> "
0040 }
0041 PROMPT_COMMAND=set_bash_prompt
0042 
0043 if [[ "$-" == *i* ]]; then
0044    # echo "Interactive shell"
0045    : # nop
0046 else
0047    echo "Non-interactive shell"
0048    return 0
0049 fi
0050 
0051 #aliases
0052 alias cqb='condor_q -batch'
0053 alias cs='condor_submit'
0054 alias gristory='history | grep -v istory| grep $@'
0055 alias rehash='hash -r'
0056 
0057 # Specialized settings for individual users of sphnxpro
0058 # Identified from ssh agent forwarding
0059 if [[ `ssh-add -l` =~ "eickolja" ]] ; then
0060     echo "Hello Kolja"
0061     export GIT_CONFIG_GLOBAL=/sphenix/u/sphnxpro/.gitconfig.kolja
0062     git config --global user.name "Kolja Kauder"
0063     git config --global user.email "kkauder@gmail.com"
0064     #git config --global push.default simple
0065     git config --global push.autoSetupRemote true
0066 
0067     # if [[ -n "$_CONDOR_SCRATCH_DIR" ]]; then
0068         # echo "_CONDOR_SCRATCH_DIR = $_CONDOR_SCRATCH_DIR"
0069     # else
0070         # echo "_CONDOR_SCRATCH_DIR is not defined."
0071         # export _CONDOR_SCRATCH_DIR=~/devkolja/condorscratch
0072         # echo " ... now set to $_CONDOR_SCRATCH_DIR"
0073     # fi
0074 
0075     # zsh-style history search
0076     bind '"\e[A": history-search-backward'
0077     bind '"\e[B": history-search-forward'
0078 
0079     # Turn off paging for psql
0080     alias psql='psql -P pager=off'
0081 
0082 fi