#!/bin/sh

# The RHEL Release level (el5 or el6)

myEL=unknown


if [[ -f /etc/redhat-release ]]; then

  /bin/grep -q ' 6\.' /etc/redhat-release
  [[ $? -eq 0 ]] && myEL=el6

  /bin/grep -q ' 5\.' /etc/redhat-release
  [[ $? -eq 0 ]] && myEL=el5

fi



# To wrap or not to wrap DQ2 Clients, that is an EL choice

case $myEL in

(el5)

  # Add the DDM wrapper to our path for DQ2 commands
  export PATH=/cvmfs/osg.mwt2.org/mwt2/sw/DDMwrap:$PATH


  # Add the DQ2Client PYTHONPATH additions for those modules needing to 'import' DQ2
  if [[ -z $PYTHONPATH ]]; then
    export PYTHONPATH=$(ddm-dq2pythonpath)
  else
    export PYTHONPATH=$(ddm-dq2pythonpath):$PYTHONPATH
  fi

  ;;


(el6)

  # Fetch a DQ2 Client
  source /cvmfs/atlas.cern.ch/repo/sw/ddm/2.4.0/setup.sh

  # Setup some Atlas dependencies
  source /cvmfs/osg.mwt2.org/mwt2/sw/Atlas/setup.sh

  ;;


(*)

  # Fetch a DQ2 Client
  source /cvmfs/atlas.cern.ch/repo/sw/ddm/2.4.0/setup.sh

  # Setup some Atlas dependencies
  source /cvmfs/osg.mwt2.org/mwt2/sw/Atlas/setup.sh

  ;;

esac

