#!/bin/bash

OP_SOURCE="$BASEDIR/optools"

_install() {
    # Some OP Tools
    cp -f $OP_SOURCE/ethtool_seting.sh /opt/op
    cp -f $OP_SOURCE/changeCpuPerfMode.sh /opt/op

    # Only Uhost and kernel "2.6.32" Need reload Microcode
    if [[ $Usgae = uhost && $(uname -r) =~ "2.6.32" ]];then
        cp -f $OP_SOURCE/reload_microcode.sh /opt/op
    fi

    # Support KVM 
    if [[ $Usage = uhost ]] \
        || [[ $Usage = uops && $SecUsage = vmzone ]] \
        || [[ $Usage = udb && $SecUsage = 'sqlserver' ]] \
        || [[ $Usage = uhadoop ]]; then

        cp -f $OP_SOURCE/set_blkio_iops.sh /opt/op
    fi
}

_check() {
    _check="PASS"

    local files="ethtool_seting.sh changeCpuPerfMode.sh"

    for file in $files
    do
        if [ ! -s "/opt/op/$file" ];then
            _check="FAIL"
            PRINT_ERR "[ERROR] File $file not found in /opt/op/."
        fi
    done
}
