<commit_before>def_path="./src/compiler/linux/"
def_bin="thrift-0.10.0"

if [ -z "$1" ]; then
    tpath=${def_path}
else
    tpath=$1
fi

if [ -z "$2" ]; then
    tbin=${def_bin}
else
    tbin=$2
fi

tversion=`echo $tbin | awk -F'thrift-' '{print $2}'`

# Check if Thrift is installed in system
echo -n "Check if Thrift is installed in system... "
installed_path=`which thrift 2>&1`
if [ $? -eq 0 ]; then
    echo "yes"
    # Check Thrift version
    echo -n "Check if Thrift version is $tversion... "
	$installed_path --version 2>&1 | grep $tversion >/dev/null
	if [ $? -eq 0 ]; then
        echo "yes"

        # Copy Thrift binary to Thrift path
        echo "INFO: Copy Thrift Binary to Pinpoint Thrift Path"
        cp ${installed_path} ${tpath}${tbin}

        if [ $? -eq 0 ]; then
            exit 0
		else
		    echo "ERROR: Thrift binary copy failed."
		    exit 1
		fi
		
	else
        echo "no"
	fi
else
    echo "no"
fi

# Check if Thrift is builded but not copied to compiler path
echo -n "Check if Thrift is builded but not copied to compiler path... "
if [ -x "thrift-$tversion/compiler/cpp/thrift" ]; then
    echo "yes"

    # Copy Thrift binary to Thrift path
    echo "INFO: Copy Thrift Binary to Pinpoint Thrift Path"
    cp thrift-$tversion/compiler/cpp/thrift ${tpath}${tbin}
    if [ $? -ne 0 ]; then
	    echo "ERROR: Thrift binary copy failed."
	    exit 1
	fi
		
    # cleanup
    rm -rf thrift-$tversion
    if [ $? -ne 0 ]; then
	    echo "WARNING: Thrift build directory cleanup failed. Please remove it manually."
	fi
    exit 0
else
    echo "no"
fi

# Check build environment
echo "INFO: Check Thrift installation environment"
if [ -f "/etc/os-release" ]; then
    # Get Linux distribution name and version.
    DIST_ID=`cat /etc/os-release | grep "^ID=" | awk -F "=" '{print $2;}' | tr -d '"'`
    DIST_VERSION=`cat /etc/os-release | grep "^VERSION_ID=" | awk -F "=" '{print $2;}' | tr -d '"' | awk -F "." '{print $1;}'`

    echo "Linux distribution: ${DIST_ID}"
    echo "Version: ${DIST_VERSION}"
else
    echo "ERROR: This Linux destribution is not supported."
	exit 1
fi

if [[ "${DIST_ID}" = "centos" || "${DIST_ID}" = "rhel" ]]; then
    if ! [ "${DIST_VERSION}" -ge 7 ]; then
        echo "ERROR: This Linux destribution version is not supported."
		exit 1
	fi
else
    echo "ERROR: This Linux destribution is not supported."
	exit 1
fi

# Check pre-installed packages
echo "INFO: Check pre-installed packages" 
pkg_count=0
if [[ "${DIST_ID}" = "centos" || "${DIST_ID}" = "rhel" ]]; then
    # Development Tools
	echo -n "Check Development Tools installed... "
    yum grouplist "Development Tools" installed 2>&1 | grep "Installed Groups:" >/dev/null
	if [ $? -eq 0 ]; then<commit_msg>[#noissue] spelling error fix of install-thrift-linux.sh<commit_after>def_path="./src/compiler/linux/"
def_bin="thrift-0.10.0"

if [ -z "$1" ]; then
    tpath=${def_path}
else
    tpath=$1
fi

if [ -z "$2" ]; then
    tbin=${def_bin}
else
    tbin=$2
fi

tversion=`echo $tbin | awk -F'thrift-' '{print $2}'`

# Check if Thrift is installed in system
echo -n "Check if Thrift is installed in system... "
installed_path=`which thrift 2>&1`
if [ $? -eq 0 ]; then
    echo "yes"
    # Check Thrift version
    echo -n "Check if Thrift version is $tversion... "
	$installed_path --version 2>&1 | grep $tversion >/dev/null
	if [ $? -eq 0 ]; then
        echo "yes"

        # Copy Thrift binary to Thrift path
        echo "INFO: Copy Thrift Binary to Pinpoint Thrift Path"
        cp ${installed_path} ${tpath}${tbin}

        if [ $? -eq 0 ]; then
            exit 0
		else
		    echo "ERROR: Thrift binary copy failed."
		    exit 1
		fi
		
	else
        echo "no"
	fi
else
    echo "no"
fi

# Check if Thrift is built but not copied to compiler path
echo -n "Check if Thrift is built but not copied to compiler path... "
if [ -x "thrift-$tversion/compiler/cpp/thrift" ]; then
    echo "yes"

    # Copy Thrift binary to Thrift path
    echo "INFO: Copy Thrift Binary to Pinpoint Thrift Path"
    cp thrift-$tversion/compiler/cpp/thrift ${tpath}${tbin}
    if [ $? -ne 0 ]; then
	    echo "ERROR: Thrift binary copy failed."
	    exit 1
	fi
		
    # cleanup
    rm -rf thrift-$tversion
    if [ $? -ne 0 ]; then
	    echo "WARNING: Thrift build directory cleanup failed. Please remove it manually."
	fi
    exit 0
else
    echo "no"
fi

# Check build environment
echo "INFO: Check Thrift installation environment"
if [ -f "/etc/os-release" ]; then
    # Get Linux distribution name and version.
    DIST_ID=`cat /etc/os-release | grep "^ID=" | awk -F "=" '{print $2;}' | tr -d '"'`
    DIST_VERSION=`cat /etc/os-release | grep "^VERSION_ID=" | awk -F "=" '{print $2;}' | tr -d '"' | awk -F "." '{print $1;}'`

    echo "Linux distribution: ${DIST_ID}"
    echo "Version: ${DIST_VERSION}"
else
    echo "ERROR: This Linux distribution is not supported."
	exit 1
fi

if [[ "${DIST_ID}" = "centos" || "${DIST_ID}" = "rhel" ]]; then
    if ! [ "${DIST_VERSION}" -ge 7 ]; then
        echo "ERROR: This Linux distribution version is not supported."
		exit 1
	fi
else
    echo "ERROR: This Linux distribution is not supported."
	exit 1
fi

# Check pre-installed packages
echo "INFO: Check pre-installed packages" 
pkg_count=0
if [[ "${DIST_ID}" = "centos" || "${DIST_ID}" = "rhel" ]]; then
    # Development Tools
	echo -n "Check Development Tools installed... "
    yum grouplist "Development Tools" installed 2>&1 | grep "Installed Groups:" >/dev/null
	if [ $? -eq 0 ]; then
{'fraction_non_alphanumeric': 0.14049135577797997, 'fraction_numerical': 0.012010919017288443, 'mean_word_length': 2.777319587628866, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1858113', 'n_tokens_mistral': 1963, 'n_tokens_neox': 1828, 'n_words': 674}