1#!/bin/bash
 2
 3# Activate Chart (python3) environment
 4if [ -f /etc/os-release ]; then
 5    ID=$(sed -ne 's/^ID=\"\{0,1\}\([^"]\+\)\"\{0,1\}/\1/p' /etc/os-release)
 6    VERSION=$(sed -ne 's/^VERSION_ID=\"\([0-9.]\+\)\"/\1/p' /etc/os-release)
 7    if [ "$ID" = "centos" ]; then
 8        if [ "$VERSION" = "7" ]; then
 9            echo "Configuring python3 Centos 7 environment"
10            source /tcenas/proj/chart/env/TST/Env/Chart3/Centos7/activate
11        else
12            echo "Unsupported CentOS version "
13        fi
14    elif [ "$ID" = "opensuse" ]; then
15        if [ "$VERSION" = "13.2" ]; then
16            echo "Configuring python3 openSuse 13 environment"
17            source /tcenas/proj/chart/env/TST/Env/Chart3/openSUSE13/activate
18        else
19            echo "Configuring python3 openSuse Leap 42 environment"
20            source /tcenas/proj/chart/env/TST/Env/Chart3/suseLeap42/activate
21        fi
22    elif [ "$ID" = "opensuse-leap" ]; then
23        if [ "$VERSION" = "15.2" ]; then
24            echo "Configuring python3 openSuse 15 environment"
25            source /tcenas/proj/chart/env/TST/Env/Chart3/opensuseleap15/activate
26        else
27            echo "Configuring python3 openSuse Leap 42 environment"
28            source /tcenas/proj/chart/env/TST/Env/Chart3/suseLeap42/activate
29        fi
30    else
31        echo 'Unsupported OS '
32    fi
33else
34    echo "Cannot find /etc/os-release to determine OS"
35fi