#!/bin/bash

# This script should be sourced at log on (e.g. in .bashrc)

export REPOS_DIR=$1
if [ -z "$DIM_DNS_NODE" ]; then export DIM_DNS_NODE=ihp-pc1.ethz.ch; fi
export DIM_HOST_NODE=$HOST.ethz.ch
if [ -z "$DIMDIR" ]; then export DIMDIR=/usr/local/dim/; fi
if [ -z "$QWTDIR" ]; then export QWTDIR=/usr/local/qwt/; fi

export LD_LIBRARY_PATH=$QWTDIR/lib:$DIMDIR/linux:$LD_LIBRARY_PATH
export PATH=$DIMDIR/linux:$REPOS_DIR/tools/Scripts:/usr/local/Trolltech/Qt-4.4.3/bin:.:$PATH

echo
echo Note: Operation needs Evidence configuration server running on $DIM_DNS_NODE
echo "To start, log on as user 'daqct3' and execute 'start' script"
echo "Contact: Oliver Grimm (32192) or Quirin Weitzel (33973)"
echo

# Check if repository is a mixed or locally modified version (only for login shell))
# The revision warning is given only once at login.

if [ "${USER}" = "daqct3" ]; then
#if shopt -q login_shell; then
if [[ `svnversion $REPOS_DIR/drsdaq -n` == *:* ]] || [[ `svnversion $REPOS_DIR/drsdaq -n` == *M ]]; then
    xterm -e "echo 'Warning: drsdaq in repository does not have a single revision number';
    echo 'Make an update before starting a run!';
    echo 'Contact O.Grimm or Q.Weitzel in case you need help';
    echo 'Hit return to continue';
    read;"
#fi
fi
fi
