#!/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 "$(readlink -f "$0")")

if [[ "$rhel_version" == "7" ]]; then
    PATH="$script_dir"/../dysh-rhel7-env/bin/:"$PATH"
else
    if [[ "$rhel_version" != "8" ]]; then
        echo "Unsupported RHEL version; defaulting to RHEL8 version of dysh..." >&2
    fi
    PATH="$script_dir"/../dysh-rhel8-env/bin/:"$PATH"
fi
source "$script_dir/../activate"
dysh "$@"
