-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
46 lines (42 loc) · 1.82 KB
/
setup.sh
File metadata and controls
46 lines (42 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# Check if the script is being sourced in bash, otherwise raise an error
export CMGRDF_CLI=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
CURRENT_SHELL=$(ps -p $$ -o comm=)
if [[ "$CURRENT_SHELL" == "zsh" ]]; then
echo "ZSH can't source the cvmfs scripts. You must source it in bash and then return to zsh" >&2
return 1
fi
# Check if the script is being sourced in bash, otherwise raise an error
if [[ ${BASH_SOURCE[0]} == $0 ]]; then
echo "You must source this script, not execute it. Run 'source setup.sh'" >&2
exit 1
fi
# Check which platform is being used and source the correct cvmfs script
source /etc/os-release
if [[ "$PLATFORM_ID" == "platform:el8" ]]; then
export PLATFORM="el8"
echo "Warning: Dask distributed submission work only on el9."
echo "apptainer shell -B /eos -B /afs -B /cvmfs /cvmfs/unpacked.cern.ch/gitlab-registry.cern.ch/sft/docker/alma9:latest"
source /cvmfs/sft.cern.ch/lcg/views/LCG_106/x86_64-el8-gcc11-opt/setup.sh
elif [[ "$PLATFORM_ID" == "platform:el9" ]]; then
export PLATFORM="el9"
source /cvmfs/sft.cern.ch/lcg/views/dev3/latest/x86_64-el9-gcc15-opt/setup.sh
else
echo "Unsupported platform: $PLATFORM_ID. You must use el8 or el9 (preferred)"
return 1
fi
CURRENT_PWD=$(pwd)
cd $CMGRDF_CLI/cmgrdf-prototype
# Check if the user wants to build cmgrdf
if [[ "$1" == "build" ]]; then
make clean
make -j 8
fi
# Set the environment variables
eval $(make env)
if [[ "$1" == "build" ]]; then
pip install -r $CMGRDF_CLI/requirements.txt --prefix $CMGRDF_CLI/.venv --no-deps --ignore-installed
fi
py_ver=`python -c 'import sys; print(".".join(map(str, sys.version_info[:2])))'`
export PYTHONPATH=$CMGRDF_CLI:$CMGRDF_CLI/.venv/lib/python$py_ver/site-packages:$PYTHONPATH
export PATH=$CMGRDF_CLI/.venv/bin:$CMGRDF_CLI:$CMGRDF_CLI/scripts:$CMGRDF_CLI/bin:$PATH
cd $CURRENT_PWD