#!/bin/bash

get_rhel_version() {
    lsb_release -i -r | grep Release | awk '{print $2}' | awk -F . '{print $1}'
}

rhel_version="$(get_rhel_version)"
script_dir="$( dirname -- "${BASH_SOURCE[0]}"; )"

export JUPYTER_CONFIG_PATH=/home/dysh/release/unstable/

if [[ "$rhel_version" == "7" ]]; then
    source "$script_dir"/dysh-rhel7-env/bin/activate
    PATH=/home/dysh/node/node-v16.20.2-linux-x64/bin/:"$PATH"
elif [[ "$rhel_version" == "8" ]]; then
    source "$script_dir"/dysh-rhel8-env/bin/activate
    PATH=/home/dysh/node/node-v20.15.0-linux-x64/bin/:"$PATH"
else
    echo "Unsupported RHEL version; defaulting to RHEL8 version of dysh..." >&2
    source "$script_dir"/dysh-rhel8-env/bin/activate
    PATH=/home/dysh/node/node-v20.15.0-linux-x64/bin/:"$PATH"
fi

export MPLBACKEND=TkAgg
