

if [ "${g10s_pub}" = "" ]
then
    g10s_LEVEL_DEBUG=0
    g10s_LEVEL_INFO=1
    g10s_LEVEL_WARN=2
    g10s_LEVEL_ERROR=3
    g10s_LEVEL_FATAL=4
    g10s_pub="yes"

    g10s_debugon=${g10s_debugon="0"}

    g10s_id=`id -u`

    g10s_result=${g10s_result=""}
    [ "${g10s_result}" != "" ] && mkdir -p "${g10s_result}"

    if [ -f /etc/UVP-release  ] && [ `cat /etc/UVP-release | grep -c "UVP"` -ne 0 ]
    then
        g10s_logDir=${g10s_logDir="${g10s_result}/var/log/UltraPath"}
        g10_logup="/var/log/UltraPath"
        g10s_seriFile="/var/log/UltraPath/serial_oper"
    elif [ -f /etc/uvp_version  ] && [ `cat /etc/uvp_version | grep -c "UVP"` -ne 0 ]
    then
        g10s_logDir=${g10s_logDir="${g10s_result}/var/log/UltraPath"}
        g10_logup="/var/log/UltraPath"
        g10s_seriFile="/var/log/UltraPath/serial_oper"
    elif [ -f /etc/EulerLinux.conf ]
    then
        g10s_logDir=${g10s_logDir="${g10s_result}/var/log/UltraPath"}
        g10_logup="/var/log/UltraPath"
        g10s_seriFile="/var/log/UltraPath/serial_oper"    
    else
        g10s_logDir=${g10s_logDir="${g10s_result}/opt/UltraPath/log"}
        g10_logup="/opt/UltraPath/"
        g10s_seriFile="/opt/UltraPath/log/serial_oper"
    fi

    [ "${g10s_logDir}" != "" ] && mkdir -p "${g10s_logDir}"
    chmod 650 "${g10_logup}" > /dev/null 2>&1
    g10s_logName=${g10s_logName:="ultrapathTool.log"}

    g10s_logFile=${g10s_logFile="${g10s_logDir}/${g10s_logName}"}
    if [ "${g10s_logFile}" != "" ] && [ ! -f "${g10s_logFile}" ]
    then
        touch "${g10s_logFile}"
    fi

    g10s_operFile=${g10s_operFile="${g10s_logDir}/oper_log"}
    if [ "${g10s_operFile}" != "" ] && [ ! -f "${g10s_operFile}" ]
    then
        touch "${g10s_operFile}"
    fi

    if [ "${g10s_tmpPath}" = "" ] && [ -w /var ] # FS is not read only
    then
        g10s_tmpPath="${g10s_result}/UltraPath/tmp"
        mkdir -m 700 -p "${g10s_tmpPath}"
    fi

    if [ "${g10s_bakPath}" = "" ]
    then
        g10s_bakPath="${g10s_result}/opt/UltraPath/backup"
        mkdir -p "${g10s_bakPath}"
    fi
    g10s_isspImageName="ultrapath"

    if [ "${g10s_isspPath}" = "" ]
    then
        g10s_isspPath="${g10s_result}/opt/UltraPath/StorageCommon"
        mkdir -p "${g10s_isspPath}"
        chmod 750 "${g10s_result}/opt/UltraPath" > /dev/null 2>&1
    fi
    g10s_isspinitrdrecordname="UltraPath"
    g10s_isspinitrdrecordfile="${g10s_isspPath}/initrdrecord"
    g10s_OtherIsspInstalled=""
    if [ "${g10s_isspinitrdrecordfile}" != "" ] && [ ! -f "${g10s_isspinitrdrecordfile}" ]
    then
        touch "${g10s_isspinitrdrecordfile}"
    fi

    if [ "${g10s_isspBakPath}" = "" ]
    then
        g10s_isspBakPath="${g10s_isspPath}/backup"
        mkdir -p "${g10s_isspBakPath}"
    fi

    g10s_debugFile=${g10s_debugFile="/tmp/CommunicationFile.20111025"}
    g10s_debugPointFile=${g10s_debugPointFile="/tmp/PointSet.20111025"}

    readonly g10s_onlinebackupDir="/opt/UltraPath/online_backup"
    readonly g10s_onlinebackupPackageDir="${g10s_onlinebackupDir}/packages"

    g10s_ultraPathPackagesInfo=${g10s_ultraPathPackagesInfo:="/etc/UltraPath.packages.info"}
    readonly g10s_ultraPathHostToolsDir="/opt/UltraPath/tools"


    g10s_isQuiet=${g10s_isQuiet:="0"}

    g10s_defaultSelect=${g10s_defaultSelect=""}

    g10s_modifySysConfAuto=${g10s_modifySysConfAuto:="1"}

    g10s_exitFun=${g10s_exitFun:="exit"}

    g10s_closeMsgHead=${g10s_closeMsgHead:="1"}

    g10s_evalFailExit=${g10s_evalFailExit:="1"}

    g10s_skipPubMain=${g10s_skipPubMain:="0"}

    g10s_R3upadm="upadm"
    g10s_R5upadm="upadmin"

    UP_CMD_PATH=/UltraPath/bin
    export PATH=$PATH:$UP_CMD_PATH

    G10S_INNER_OS_NAME=""
    G10S_INNER_OS_TYPE=""
    G10S_INNER_UNAME_R=""
    G10S_INNER_KERNEL_TYPE=""
    G10S_INNER_MODULES_DIR=""
    G10S_INNER_MODE=""
    G10S_INNER_FLAG=""
    G10S_CUR_MODULES_DIR=""
    G10S_CUR_MODE=""
    G10S_CUR_FLAG=""
    G10S_CUR_OS_LIB_DIR=""

    function print_stack()
    {
        [ "${g10s_debugon}" = "1" ] && echo "-----------------------------stack begin---------------------------------"
        [ "${g10s_logFile}" != "" ] && [ -w "${g10s_logFile}" ] && echo "-----------------------------stack begin---------------------------------" >> "${g10s_logFile}"
        local i=0
        local j=0
        local tmpFun=""

        [ "${g10s_debugon}" = "1" ] && echo "-----FILENAME , FUNCTIONNAME , LINENO-----"
        [ "${g10s_logFile}" != "" ] && [ -w "${g10s_logFile}" ] && echo "-----FILENAME , FUNCTIONNAME , LINENO-----" >> "${g10s_logFile}"
        for tmpFun in "${FUNCNAME[@]}"
        do
            if [ ${i} -eq 0 ]
            then
                let "i=i+1"
                continue
            fi
            [ "${g10s_debugon}" = "1" ] && echo "-----${BASH_SOURCE[${i}]} , ${FUNCNAME[${i}]} , ${BASH_LINENO[${j}]}-----"
            [ "${g10s_logFile}" != "" ] && [ -w "${g10s_logFile}" ] && echo "-----${BASH_SOURCE[${i}]} , ${FUNCNAME[${i}]} , ${BASH_LINENO[${j}]}-----" >> "${g10s_logFile}"
            j=${i}
            let "i=i+1"
        done
        [ "${g10s_debugon}" = "1" ] && echo "-----------------------------stack end---------------------------------"
        [ "${g10s_logFile}" != "" ] && [ -w "${g10s_logFile}" ] && echo "-----------------------------stack end---------------------------------" >> "${g10s_logFile}"
        return 0
    }

    function print_debug()
    {
        local fileFlag=""

        if [ "$2" != "" ]
        then
            fileFlag=$2
        else
            fileFlag=${0##*/}
            fileFlag=${fileFlag%%_*}
        fi
        if [ "${g10s_debugon}" = "1" ]
        then
            if [ "${g10s_closeMsgHead}" = "0" ]
            then
                echo -e -n "\033[0;32;32m[DEBUG:0][${fileFlag}][`date +%Y-%m-%d_%H:%M:%S`][$0,${FUNCNAME[1]},${BASH_LINENO[0]}]\033[0m ";echo "$1"
            else
                echo -e -n "\033[0;32;32m[DEBUG]\033[0m ";echo "$1"
            fi
        fi
        [ "${g10s_logFile}" != "" ] && [ -w "${g10s_logFile}" ] && echo "[DEBUG:0][${fileFlag}][`date +%Y-%m-%d_%H:%M:%S`][${g10s_id}][$0,${FUNCNAME[1]},${BASH_LINENO[0]}] $1">>"${g10s_logFile}"
        return 0
    }

    if [ "${G10S_CUR_DIR}" != "" ]; then
        if [ $(echo "${G10S_CUR_DIR}" | grep -c "/g10s_pub") -eq 0 ]; then
            print_error "0" "invalid lib path[${G10S_CUR_DIR}], ignoring" "$0"
        else
            G10S_CUR_OS_LIB_DIR=$(dirname $(readlink -f "${G10S_CUR_DIR}"))
            G10S_CUR_OS_LIB_DIR="${G10S_CUR_OS_LIB_DIR}/g10c_runConf"
        fi
    fi

    function print_file()
    {
        local fileFlag=""

        if [ "$2" != "" ]
        then
            fileFlag=$2
        else
            fileFlag=${0##*/}
            fileFlag=${fileFlag%%_*}
        fi
        [ "${g10s_logFile}" != "" ] && [ -w "${g10s_logFile}" ] && echo  "[FILE:1][${fileFlag}][`date +%Y-%m-%d_%H:%M:%S`][${g10s_id}][$0,${FUNCNAME[1]},${BASH_LINENO[0]}] $1">>"${g10s_logFile}"
        return 0
    }

    function print_oper()
    {
        local fileFlag=""
        local index=0
        if [ -f "$g10s_seriFile" ]
        then
            index=`cat "$g10s_seriFile"`
        fi

        if [ "$2" != "" ]
        then
            fileFlag=$2
        else
            fileFlag=${0##*/}
            fileFlag=${fileFlag%%_*}
        fi
        if [ "$4" != "" ] && [ "$5" != "" ]
        then
            [ -f "${g10s_operFile}" ] && [ -w "${g10s_operFile}" ] && echo  "[$index] [`date +%Y-%m-%d_%H:%M:%S`] [`id -u`] [CLI] [$3] $5 $1 $4 $2">>"${g10s_operFile}"
        else
            [ -f "${g10s_operFile}" ] && [ -w "${g10s_operFile}" ] && echo  "[$index] [`date +%Y-%m-%d_%H:%M:%S`] [`id -u`] [CLI] [$3] $1 $2">>"${g10s_operFile}"
        fi
        let index=$index+1
        echo "$index"> "$g10s_seriFile"
        return 0
    }

    function print_event()
    {
        local fileFlag=""

        if [ `echo "$1"|grep -E -c "[0-9]+"` -eq 0 ] || [ "$2" = "" ]
        then
            echo -e -n "\033[31m[ERROR:2][g10s][`date +%Y-%m-%d_%H:%M:%S`][$0,${FUNCNAME[1]},${BASH_LINENO[0]}]\033[0m ";echo "param error[$1,$2]"
            [ "${g10s_logFile}" != "" ] && [ -w "${g10s_logFile}" ] && echo "[ERROR:2][g10s][`date +%Y-%m-%d_%H:%M:%S`][${g10s_id}][$0,${FUNCNAME[1]},${BASH_LINENO[0]}] param error[$1,$2]" >> "${g10s_logFile}"
            print_stack
            eval "${g10s_exitFun} 1"
        fi
        if [ "$3" != "" ]
        then
            fileFlag=$3
        else
            fileFlag=${0##*/}
            fileFlag=${fileFlag%%_*}
        fi

        if [ "${g10s_closeMsgHead}" = "0" ]
        then
            echo -e -n "[EVENT:$1][${fileFlag}][`date +%Y-%m-%d_%H:%M:%S`][$0,${FUNCNAME[1]},${BASH_LINENO[0]}] "
        fi
        echo "$2"
        [ "${g10s_logFile}" != "" ] && [ -w "${g10s_logFile}" ] && echo "[EVENT:$1][${fileFlag}][`date +%Y-%m-%d_%H:%M:%S`][${g10s_id}][$0,${FUNCNAME[1]},${BASH_LINENO[0]}] $2">>"${g10s_logFile}"
        return 0
    }

    function print_warning()
    {
        local fileFlag=""

        if [ "$2" = "" ] || [ `echo "$1"|grep -E -c "[0-9]+"` -eq 0 ]
        then
            echo -e -n "\033[31m[ERROR:2][g10s][`date +%Y-%m-%d_%H:%M:%S`][$0,${FUNCNAME[1]},${BASH_LINENO[0]}]\033[0m ";echo "param error[$1,$2]"
            [ "${g10s_logFile}" != "" ] && [ -w "${g10s_logFile}" ] && echo  "[ERROR:2][g10s][`date +%Y-%m-%d_%H:%M:%S`][${g10s_id}][$0,${FUNCNAME[1]},${BASH_LINENO[0]}] param error[$1,$2]" >> "${g10s_logFile}"
            print_stack
            eval "${g10s_exitFun} 1"
        fi
        if [ "$3" != "" ]
        then
            fileFlag=$3
        else
            fileFlag=${0##*/}
            fileFlag=${fileFlag%%_*}
        fi

        if [ "${g10s_closeMsgHead}" = "0" ]
        then
            echo -e -n "\033[35m[WARNING:$1][${fileFlag}][`date +%Y-%m-%d_%H:%M:%S`][$0,${FUNCNAME[1]},${BASH_LINENO[0]}]\033[0m ";echo "$2"
        else
            echo -e -n "\033[35m[WARNING]\033[0m ";echo "$2"
        fi
        [ "${g10s_logFile}" != "" ] && [ -w "${g10s_logFile}" ] && echo  "[WARNING:$1][${fileFlag}][`date +%Y-%m-%d_%H:%M:%S`][${g10s_id}][$0,${FUNCNAME[1]},${BASH_LINENO[0]}] $2">>"${g10s_logFile}"
        print_stack
        return 0
    }

    function print_error()
    {
        local fileFlag=""
        local tmpDebugon=""

        if [ "$2" = "" ] || [ `echo "$1"|grep -E -c "[0-9]+"` -eq 0 ]
        then
            echo -e -n "\033[31m[ERROR:2][g10s][`date +%Y-%m-%d_%H:%M:%S`][$0,${FUNCNAME[1]},${BASH_LINENO[0]}]\033[0m ";echo "param error[$1,$2]"
            [ "${g10s_logFile}" != "" ] && [ -w "${g10s_logFile}" ] && echo "[ERROR:2][g10s][`date +%Y-%m-%d_%H:%M:%S`][${g10s_id}][$0,${FUNCNAME[1]},${BASH_LINENO[0]}] param error[$1,$2]" >> "${g10s_logFile}"
            print_stack
            eval "${g10s_exitFun} 1"
        fi
        if [ "$3" != "" ]
        then
            fileFlag=$3
        else
            fileFlag=${0##*/}
            fileFlag=${fileFlag%%_*}
        fi

        if [ "${g10s_closeMsgHead}" = "0" ]
        then
            echo -e -n "\033[31m[ERROR:$1][${fileFlag}][`date +%Y-%m-%d_%H:%M:%S`][$0,${FUNCNAME[1]},${BASH_LINENO[0]}]\033[0m ";echo "$2"
        else
            echo -e -n "\033[31m[ERROR]\033[0m ";echo "$2"
        fi
        [ "${g10s_logFile}" != "" ] && [ -w "${g10s_logFile}" ] && echo  "[ERROR:$1][${fileFlag}][`date +%Y-%m-%d_%H:%M:%S`][${g10s_id}][$0,${FUNCNAME[1]},${BASH_LINENO[0]}] $2">>"${g10s_logFile}"

        if [ "${g10s_closeMsgHead}" = "0" ]
        then
            tmpDebugon="${g10s_debugon}"
            g10s_debugon="1"
            print_stack
            g10s_debugon="${tmpDebugon}"
        else
            print_stack
        fi
        return 0
    }

    function g10s_chmodExec()
    {
        local ret=""
        if [ "$1" = "" ] || [ "$2" = "" ]
        then
            return 1
        fi
        
        if [ "$3" != "" ]
        then
            chmod "$1" "$2" "$3" > /dev/null 2>&1
            ret=$?
            if [ ${ret} -ne 0 ]
            then
                print_debug "chmod $1 $2 $3 failed."
                return ${ret}
            fi
        else
            chmod "$1" "$2" > /dev/null 2>&1
            ret=$?
            if [ ${ret} -ne 0 ]
            then
                print_debug "chmod $1 $2 failed."
                return ${ret}
            fi
        fi
    }
    
    function g10s_upper()
    {
        echo "$1"|tr '[a-z]' '[A-Z]'
        return 0
    }

    function g10s_lower()
    {
       echo "$1"|tr '[A-Z]' '[a-z]'
       return 0
    }

    function print_yesOrNo()
    {
        local fileFlag=""
        local userInput=""
        local isoutputyes=""

        if [ "$2" = "" ] || [ `echo "$1"|grep -E -c "[0-9]+"` -eq 0 ]
        then
            print_error "2" "param error[$1,$2]" "g10s"
            eval "${g10s_exitFun} 1"
        fi
        if [ "$3" != "" ]
        then
            fileFlag=$3
        else
            fileFlag=${0##*/}
            fileFlag=${fileFlag%%_*}
        fi

        if [ "$4" != "" ]
        then
            isoutputyes="yes"
        fi

        while [ 1 -eq 1 ]
        do
            if [ "${g10s_closeMsgHead}" = "0" ]
            then
                echo -e "\033[0;32;32m[YESORNO:$1][${fileFlag}][`date +%Y-%m-%d_%H:%M:%S`][$0,${FUNCNAME[1]},${BASH_LINENO[0]}]\033[0m "
            fi
            [ "${g10s_closeMsgHead}" = "0" ] && echo "------------begin-----------YES or NO box---------------------------"
            echo "$2"
            [ "${g10s_logFile}" != "" ] && echo "[YESORNO:$1][${fileFlag}][`date +%Y-%m-%d_%H:%M:%S`][$0,${FUNCNAME[1]},${BASH_LINENO[0]}] " >> "${g10s_logFile}"
            [ "${g10s_logFile}" != "" ] && echo "$2" >> "${g10s_logFile}"

            [ "${g10s_closeMsgHead}" = "0" ] && echo "------------end-------------YES or NO box---------------------------"

            if [ "${isoutputyes}" != "" ]
            then
                echo -n "<yes|no>:"
            else
                echo -n "<Y|N>:"
            fi


            read userInput
            userInput=$(g10s_lower "${userInput}")
            if [ "${userInput}" != "yes" ] && \
                [ "${userInput}" != "y" ] && \
                [ "${userInput}" != "no" ] && \
                [ "${userInput}" != "n" ]
            then
                print_warning "31" "you select is incorrect[${userInput}]" "g10s"
                continue
            fi

            print_debug "your selection is [${userInput}]" "g10s"
            if [ "${userInput}" = "yes" ] || \
                    [ "${userInput}" = "y" ]
            then
                return 0
            else
                return 1
            fi
        done
        return 0
    }

    declare -a g10s_singleSelectSets

    function print_singleSelect()
    {
        local fileFlag=""
        local tmpIndex=""
        local i=0
        local iCount=0
        local tmpMsg=""
        local isCorrect=""
        local userInput=""

        if [ "$2" = "" ] || [ `echo "$1"|grep -E -c "[0-9]+"` -eq 0 ]
        then
            print_error "2" "param error[$1,$2]" "g10s"
            g10s_defaultSelect=""
            eval "${g10s_exitFun} 1"
        fi

        i=0
        iCount=${#g10s_singleSelectSets[@]}
        if [ ${iCount} -le 0 ]
        then
            print_error "2" "g10s_singleSelectSets is not set" "g10s"
            g10s_defaultSelect=""
            eval "${g10s_exitFun} 1"
        fi

        if [ "$3" != "" ]
        then
            fileFlag=$3
        else
            fileFlag=${0##*/}
            fileFlag=${fileFlag%%_*}
        fi
        while [ 1 -eq 1 ]
        do
            if [ "${g10s_closeMsgHead}" = "0" ]
            then
                echo -e "\033[0;32;32m[SINGLESELECT:$1][${fileFlag}][`date +%Y-%m-%d_%H:%M:%S`][$0,${FUNCNAME[1]},${BASH_LINENO[0]}]\033[0m "
            fi
            [ "${g10s_closeMsgHead}" = "0" ] && echo "------------begin-----------single-select box---------------------------"
            echo "$2"
            [ "${g10s_logFile}" != "" ] && echo "[SINGLESELECT:$1][${fileFlag}][`date +%Y-%m-%d_%H:%M:%S`][$0,${FUNCNAME[1]},${BASH_LINENO[0]}] " >> "${g10s_logFile}"
            [ "${g10s_logFile}" != "" ] && echo "$2" >> "${g10s_logFile}"
            i=0
            while [ ${i} -lt ${iCount} ]
            do
                if [ `echo "${g10s_singleSelectSets[${i}]}" | grep -c "^[0-9][0-9]*$"` -ne 1 ]
                then
                    print_error "2" "g10s_singleSelectSets is incorrect" "g10s"
                    g10s_defaultSelect=""
                    eval "${g10s_exitFun} 1"
                fi
                tmpIndex="${g10s_singleSelectSets[${i}]}"
                let "i=i+1"
                if [ "${g10s_singleSelectSets[${i}]}" = "" ]
                then
                    print_error "2" "g10s_singleSelectSets is incorrect" "g10s"
                    g10s_defaultSelect=""
                    eval "${g10s_exitFun} 1"
                fi
                tmpMsg="${g10s_singleSelectSets[${i}]}"
                let "i=i+1"
                echo "<${tmpIndex}>--${tmpMsg}"
            done

            if [ "${g10s_defaultSelect}" != "" ]
            then
                print_debug "default select is [${g10s_defaultSelect}]" "g10s"
            fi
            [ "${g10s_closeMsgHead}" = "0" ] && echo "------------end-------------single-select box---------------------------"
            echo -n "please input your select:"



            if [ "${g10s_isQuiet}" = "0" ]
            then
                read userInput


                i=0
                isCorrect="0"
                while [ ${i} -lt ${iCount} ]
                do
                    if [ "${g10s_singleSelectSets[${i}]}" = "${userInput}" ]
                    then
                        isCorrect="1"
                        break
                    fi
                    let "i=i+2"
                done
                if [ "${isCorrect}" = "0" ]
                then
                    print_warning "31" "you select is incorrect[${userInput}]" "g10s"
                    continue
                fi
            else

                userInput=$(echo ${g10s_defaultSelect})
                echo "${userInput}"

                i=0
                isCorrect="0"
                while [ ${i} -lt ${iCount} ]
                do
                    if [ "${g10s_singleSelectSets[${i}]}" = "${userInput}" ]
                    then
                        isCorrect="1"
                        break
                    fi
                    let "i=i+2"
                done
                if [ "${isCorrect}" = "0" ]
                then
                    print_warning "31" "you select is incorrect[${userInput}]" "g10s"
                    g10s_defaultSelect=""
                    eval "${g10s_exitFun} 1"
                fi
            fi


            print_debug "your selection is [${userInput}]" "g10s"
            g10s_defaultSelect=""
            return ${userInput}
        done
        return 0
    }

    function g10s_eval()
    {
        if [ "$1" = "" ]
        then
            print_error "2" "param error" "g10s"
            eval "${g10s_exitFun} 1"
        fi
        eval "${1}"
        if [ $? -ne 0 ]
        then
            if [ "${g10s_evalFailExit}" = "1" ]
            then
                print_debug "eval failed.[${1}]" "g10s"
                eval "${g10s_exitFun} 1"
            else
                print_debug "eval failed." "g10s"
                return 1
            fi
        fi
        return 0
    }

    function g10s_cp()
    {
        if [ "$1" = "" ] || [ "$2" = "" ]
        then
            print_error "2" "param error[$1,$2]" "g10s"
            eval "${g10s_exitFun} 1"
        fi

        if [ -L "$1" ]
        then

            cp -pf "$1" "$2"
            ret=$?
        else
            cp -af "$1" "$2"
            ret=$?
        fi
        if [ ${ret} -ne 0 ]
        then
            print_error "3" "copy file failed[$1 to $2]" "g10s"
            eval "${g10s_exitFun} 1"
        fi
        return 0
    }

    function g10s_cleanDir()
    {
        if [ -d "$1" ]
        then
            rm -rf "$1"
        fi
        mkdir -p "$1"
        return 0
    }

    function g10s_checkExist()
    {
        local condition=""
        if [ -z "$1" ] || [ -z "$2" ] || [ -z "$3" ]
        then
            print_error "1" "param error[$1,$2,$3]" "g10s"
            eval "${g10s_exitFun} 1"
        fi
        
        condition="${1} ${2}"
        if [ ${condition} ]
        then

            if [ "$3" = "1" ]
            then
                print_error "4" "file or directory is exist[$2]" "g10s"
                eval "${g10s_exitFun} 1"
            fi
        else

            if [ "$3" = "2" ]
            then
                print_error "5" "file or directory is not exist[$2]" "g10s"
                eval "${g10s_exitFun} 1"
            fi
        fi
        return 0
    }
    
    function g10s_untrustyCheckForDir()
    {
        local checkObj="${1}"
        
        if [ -z "${checkObj}" ]
        then
            print_debug "param is empty[${checkObj}]" "g10s"
            return 1
        fi
        
        if [ ! -d "${checkObj}" ]
        then 
            print_debug "check direct [${checkObj}] is not exist" "g10s"
            print_stack
            return 1
        fi
        
        return 0
    }
    
    function g10s_untrustyCheckForCommand()
    {
        local checkResult="${1}"
        local checkCommand="${2}"
        
        if [ -z "${checkResult}" ] || [ -z "${checkCommand}" ]
        then
            print_debug "param is empty[${checkResult},${checkCommand}]" "g10s"
            return 1
        fi
        
        if [ "${checkResult}" -ne 0 ]
        then
            print_debug "command [${checkCommand}] excuting failed" "g10s"
            print_stack
            
            return ${checkResult}
        fi
        return 0
    }
    
    function g10s_untrustyCheckForFile()
    {
        local checkObj="${1}"
        
        if [ -z "${checkObj}" ]
        then
            print_debug "param is empty[${checkObj}]" "g10s"
            return 1
        fi
                        
        if [ ! -e "${checkObj}" ]
        then
            print_debug "check file [${checkObj}] is not exist" "g10s"
            print_stack
            return 1
        fi
                        
        if [ ! -s "${checkObj}" ]
        then
            print_debug "check file [${checkObj}] is empty" "g10s"
            print_stack
            return 1
        fi
        
        return 0
    }

    function g10s_checkCommandIsExisted()
    {
        if [ -z "${1}" ]
        then
            print_debug "param is empty." "g10s"
            return 1
        fi

        type ${1}> /dev/null 2>&1
        if [ $? -ne 0 ]
        then
            print_debug "the command [${1}] is not existed." "g10s"
            return 1
        fi

        return 0
    }

    function g10s_removeBlank()
    {
        if [ -z "$1" ] || [ -z "$2" ]
        then
            print_error "1" "param error[$1,$2]" "g10s"
            eval "${g10s_exitFun} 1"
        fi

        g10s_checkExist -f "$1" 2

        sed "{/^[[:blank:]]*#.*/d;/^[[:blank:]]*$/d;s/#.*$//g;s/\r//}" "$1" > "$2"
        if [ $? -ne 0 ]
        then
            print_error "6" "remove blank failed[$1,$2]" "g10s"
            eval "${g10s_exitFun} 1"
        fi


        if [ `echo "$2"|sed -n '$p'|grep -c "^[[:blank:]]*$"` -eq 0 ]
        then
            echo "" >> "$2"
        fi
        return 0
    }

    function g10s_rootCheck()
    {
        if [ "`id -u`" -ne 0 ]
        then
            print_error "7" "must login as root" "g10s"
            eval "${g10s_exitFun} 1"
        fi
        return 0
    }

    function g10s_curDirCheck()
    {
        if [ `echo $0|grep "/"|wc -l` -ne 0 ] && [ `echo $0|grep -c "^[[:blank:]]*\./[^/]*$"` -eq 0 ]
        then
            print_error "8" "please run this shell at the directory where the shell is in[$0]" "g10s"
            eval "${g10s_exitFun} 1"
        fi

        if [ `pwd|grep " "|wc -l` -ne 0 ]
        then
            print_error "9" "the directory has space key[`pwd`]" "g10s"
            eval "${g10s_exitFun} 1"
        fi
        return 0
    }

    function g10s_checkDiskSpace()
    {
        local spaceStr=""
        local freeSpace=""

        if [ -z "$1" ] || [ -z "$2" ]
        then
            print_error "2" "param error[$1,$2]" "g10s"
            if [ "${UnattendInstallUltraPathFlag}" = "1" ]
            then
                waring_error_flag=1
                return 1
            else
                eval "${g10s_exitFun} 1"
            fi
        fi
        spaceStr=`df -k "$1" 2>/dev/null | sed -n '$p' |  grep ".*[[:blank:]][[:blank:]]*[0-9][0-9]*[[:blank:]][[:blank:]]*[0-9][0-9]*%[[:blank:]][[:blank:]]*/.*$"`
        if [ "${spaceStr}" = "" ]
        then
            print_error "10" "get disk free space failed.[$1]" "g10s"
            if [ "${UnattendInstallUltraPathFlag}" = "1" ]
            then
                waring_error_flag=1
                return 1
            else
                eval "${g10s_exitFun} 1"
            fi
        fi

        freeSpace=`df -k "$1" 2>/dev/null | sed -n '$p' | grep ".*[[:blank:]][[:blank:]]*[0-9][0-9]*[[:blank:]][[:blank:]]*[0-9][0-9]*%[[:blank:]][[:blank:]]*/.*$" | awk '{print $(NF-2)}'`
        if [ -z "${freeSpace}" ] || [ ${freeSpace} -lt $2 ]
        then
            let freeSpaceSize="$2"/1000
            print_error "11" "more disk free space need[$1,"$freeSpaceSize"MB]" "g10s"
            if [ "${UnattendInstallUltraPathFlag}" = "1" ]
            then
                waring_error_flag=1
                return 1
            else
                eval "${g10s_exitFun} 1"
            fi
        fi
        return 0
    }

    function g10s_checkMemSpace()
    {
        local spaceStr=""

        if [ -z "$1" ]
        then
            print_error "2" "param error[$1]" "g10s"
            eval "${g10s_exitFun} 1"
        fi
        spaceStr=`cat /proc/meminfo|awk '/MemFree/{print $2}'`
        if [ "${spaceStr}" = "" ]
        then
            print_error "13" "get memory free space failed" "g10s"
            eval "${g10s_exitFun} 1"
        fi


        [ ${spaceStr} -gt $1 ] 2>/dev/null
        if [ $? -ne 0 ]
        then
            let freeSpaceMB="$1"/1000
            print_error "14" "more memory free space need["${freeSpaceMB}"MB]" "g10s"
            eval "${g10s_exitFun} 1"
        fi
        return 0
    }

    function g10s_debugPoint()
    {
        local debugmsg=""

        if [ "$1" = "" ]
        then
            print_error "2" "param error[$1]" "g10s"
            eval "${g10s_exitFun} 1"
        fi
        if [ -e "${g10s_debugFile}" ]
        then
            while [ 1 -eq 1 ]
            do
                if [ -f "${g10s_debugPointFile}" ]
                then
                    debugmsg=`cat "${g10s_debugPointFile}"`
                    rm -f "${g10s_debugPointFile}"
                else
                    print_debug "point[$1] wait for debug command." "g10s"
                    debugmsg=`cat "${g10s_debugFile}"`
                fi

                if [ `echo "${debugmsg}"|grep "^point:"|wc -l` -ne 0 ]
                then
                    if [ "${debugmsg}" != "point:$1" ] && [ "${debugmsg}" != "point:ALL" ]
                    then

                        print_debug "point[$1] is not [$debugmsg],skip." "g10s"
                        echo "$debugmsg">"${g10s_debugPointFile}"
                        break
                    fi
                elif [ `echo "$debugmsg"|grep "^command:"|wc -l` -ne 0 ]
                then
                    debugmsg=${debugmsg/#"command:"/}
                    print_debug "point[$1] command:[${debugmsg}]" "g10s"
                    eval "${debugmsg}"
                    if [ $? -ne 0 ]
                    then
                        print_error "12" "debug command failed[${debugmsg}]" "g10s"
                    fi
                elif [ `echo "${debugmsg}"|grep "^quit:"|wc -l` -ne 0 ]
                then
                    print_debug "end debug[$1]." "g10s"
                    break
                else
                    print_debug "unknown command[point:$1,command:${debugmsg}]." "g10s"
                fi
            done
        fi
        return 0
    }


    function g10s_bakFileForce()
    {
        local actionList=""
        local datetmp=""
        local dst=""

        actionList="$4"
        if [ "${actionList}" = "" ]
        then
            actionList="${g10s_bakPath}/g10s_action.lst.default"
            [ ! -f "${actionList}" ] && touch "${actionList}"
        fi
        if [ "$1" = "" ] || [ "$2" = "" ] || [ "$3" = "" ]
        then
            print_error "2" "need 3 param" "g10s"
            eval "${g10s_exitFun} 1"
        fi
        if [ `echo "$1"|grep -c "^/"` -eq 0 ] || [ `echo "$2"|grep -c "^/"` -eq 0 ]
        then
            print_error "2" "param error,need full directory[$1,$2]" "g10s"
            eval "${g10s_exitFun} 1"
        fi
        g10s_checkExist -f "${actionList}" 2

        datetmp=`date +%Y%m%d%H%M%S`
        dst="${2}_${datetmp}"
        if [ -f "$1" ]
        then
            g10s_cp "$1" "${dst}"

            echo "${3}==${datetmp}==copy==${dst}==$1==[$0,${FUNCNAME[1]},${BASH_LINENO[0]}]" >> "${actionList}"
        else
            print_warning "24" "skip backup[$1]" "g10s"
            echo "skip==[$1]">>"${actionList}"
        fi
        return 0
    }

    function g10s_lockShell()
    {
        local thepid=""
        local ret=""

        if [ "$1" = "" ]
        then
            print_error "2" "need a param" "g10s"
            exit 1
        fi
        print_debug "lock shell[${1}]" "g10s"
        if [ -f "${1}" ]
        then
          thepid=`cat "${1}"`
          if [ "${thepid}" != "" ]
          then
              ret=`ps ax |awk '{print $1}'| grep -c "^[[:blank:]]*${thepid}[[:blank:]]*$"`
              if [ ${ret} -eq 1 ]
              then
                  print_error "18" "this shell is already running, exit." "g10s"
                  [ "${g10s_logFile}" != "" ] && ps aux>>"${g10s_logFile}" 2>&1
                  exit 1
              fi
          fi
        fi
         echo $$ > "${1}"
         return 0
    }

    function g10s_unlockShell()
    {
        if [ "$1" = "" ]
        then
            print_error "2" "need a param" "g10s"

            exit 1
        fi
        if [ -f "${1}" ]
        then
            print_debug "unlock shell[${1}]" "g10s"
            rm -f "${1}"
        fi
        return 0
    }

    g10s_equalLines=""
    function g10s_getEqualLines()
    {
       local iCount
       local iResult
       local targetMsg
       local singleLine
       local fullLine
       local i


       g10s_equalLines=""
       if [ "${1}" = "" ] || [ "${2}" = "" ]
       then
            print_error "2" "param error[$1,$2]" "g10s"
            eval "${g10s_exitFun} 1"
       fi
       iCount=`echo "${1}"|grep -v "^[[:blank:]]*$"|wc -l`
       iResult=0
       targetMsg="$(echo ${2})"
       singleLine=""
       fullLine=""

       for (( i=1; i<=iCount; i=i+1 ))
       do
            fullLine=`echo "${1}"|sed -n "${i}p"`
            if [ "$4" != "" ]
            then
                singleLine=${fullLine%%${4}*}
            fi
            if [ "$3" != "" ]
            then
                singleLine=${singleLine#*${3}}
            fi
            singleLine=$(echo ${singleLine})
            if [ "${singleLine}" = "${targetMsg}" ]
            then
                let "iResult=iResult+1"
                if [ "${g10s_equalLines}" = "" ]
                then
                    g10s_equalLines="${fullLine}"
                else
                    g10s_equalLines="${g10s_equalLines}\n${fullLine}"
                fi
            fi
       done
       return ${iResult}
    }


    function g10s_getEqualLines2()
    {
       g10s_equalLines=""
       if [ "${1}" = "" ] || [ "${2}" = "" ]
       then
            print_error "2" "param error[$1,$2]" "g10s"
            eval "${g10s_exitFun} 1"
       fi
       local iCount=`echo "${1}"|grep -v "^[[:blank:]]*$"|wc -l`
       local iResult=0
       local targetMsg="$(echo ${2})"
       local singleLine=""
       local fullLine=""
       local i=0

       for (( i=1; i<=iCount; i=i+1 ))
       do
            fullLine=`echo "${1}"|sed -n "${i}p"`

            if [ "$3" != "" ]
            then
                singleLine=${fullLine#*${3}}
            fi
            if [ "$4" != "" ]
            then
                singleLine=${singleLine%%${4}*}
            fi

            singleLine=$(echo ${singleLine})
            if [ "${singleLine}" = "${targetMsg}" ]
            then
                let "iResult=iResult+1"
                if [ "${g10s_equalLines}" = "" ]
                then
                    g10s_equalLines="${fullLine}"
                else
                    g10s_equalLines="${g10s_equalLines}\n${fullLine}"
                fi
            fi
       done
       return ${iResult}
    }

    function g10s_replaceSingleLine()
    {
        local tmpFile=""
        local lineNum=""
        local preLineNum=""
        local nextLineNum=""
        local lineCount=""

        tmpFile="${g10s_tmpPath}/g10s_replaceSingleLine.tmp.file.$$"
        if [ "$1" = "" ] || [ ! -f "$1" ] || [ "$2" = "" ] || [ "$3" = "" ]
        then
            print_error "2" "param error.[$1,$2,$3]" "g10s"
            eval "${g10s_exitFun} 1"
        fi

        rm -f "${tmpFile}"
        touch "${tmpFile}"
        lineNum=`cat "${1}" 2>/dev/null|grep -n "$2"|tail -n 1|awk -F ":" '{print $1}'`
        print_debug "lineNum=${lineNum}" "g10s"
        if ! [ ${lineNum} -gt 0 ] 2>/dev/null
        then
            print_error "29" "get lineNum failed[${lineNum}]." "g10s"
            eval "${g10s_exitFun} 1"
        fi

        preLineNum=${lineNum}
        nextLineNum=${lineNum}
        let "preLineNum=preLineNum-1"
        let "nextLineNum=nextLineNum+1"
        if [ ${preLineNum} -ge 1 ]
        then
            cat "${1}"|sed -n "1,${preLineNum}p">>"${tmpFile}"
        fi
        echo "${3}">>"${tmpFile}"
        lineCount=`cat "${1}"|wc -l`
        print_debug "lineCount=${lineCount}" "g10s"
        if [ ${lineCount} -ge ${nextLineNum} ]
        then
            cat "${1}"|sed -n "${nextLineNum},${lineCount}p">>"${tmpFile}"
        fi


        if [ `cat "${tmpFile}"|wc -l` -ge 1 ]
        then
            cat "${tmpFile}" > "${1}"
            rm -f "${tmpFile}"
        else
            print_error "30" "g10s_replaceSingleLine failed." "g10s"
            rm -f "${tmpFile}"
            eval "${g10s_exitFun} 1"
        fi
        return 0
    }

    g10s_confValue=""
    function g10s_getConf()
    {
        g10s_confValue=""
        if [ "$1" = "" ] || [ "$2" = "" ]
        then
            print_error "2" "need 2 param." "g10s"
            eval "${g10s_exitFun} 1"
        fi
        if [ -f "$1" ]
        then
            g10s_confValue=`cat "$1" 2>/dev/null|grep "^[[:blank:]]*$2[[:blank:]]*=[^=]*"|tail -n 1`
            g10s_confValue=${g10s_confValue%%#*}
            g10s_confValue=${g10s_confValue##*=}
            g10s_confValue=${g10s_confValue#*\"}
            g10s_confValue=${g10s_confValue#*\'}
            g10s_confValue=${g10s_confValue%\"*}
            g10s_confValue=${g10s_confValue%\'*}
            g10s_confValue=$(echo ${g10s_confValue})
        fi
        return 0
    }

    function g10s_saveConf()
    {
        local ret=""

        if [ "$1" = "" ] || [ "$2" = "" ] || [ "$3" = "" ]
        then
            print_error "2" "param error." "g10s"
            eval "${g10s_exitFun} 1"
        fi
        if [ ! -f "$1" ]
        then
            touch "$1"
            g10s_chmodExec 600 "$1"
            if [ $? -ne 0 ]
            then
                print_error "25" "create config file failed.[$1]" "g10s"
                eval "${g10s_exitFun} 1"
            fi
        fi

        ret=`cat "$1"|grep -c "^[[:blank:]]*$2[[:blank:]]*=[^=]*"`
        if [ ${ret} -eq 1 ]
        then
            ret=`cat "$1"|grep -c "^[[:blank:]]*$2[[:blank:]]*=[[:blank:]]*$3$"`
            if [ $ret -eq 0 ]
            then
                if [ -w "$1" ]
                then
                    sed -i "s/^[[:blank:]]*$2[[:blank:]]*=[^=]*$/$2=$3/" "$1"
                    if [ $? -ne 0 ]
                    then
                        print_error "26" "delete item failed.[$1,$2,$3]" "g10s"
                        eval "${g10s_exitFun} 1"
                    fi
                fi
            fi
        elif [ ${ret} -eq 0 ]
        then

            echo "$2=$3" >> "$1"
            if [ $? -ne 0 ]
            then
                print_error "27" "save item failed.[$1,$2,$3]" "g10s"
                eval "${g10s_exitFun} 1"
            fi
        else
            print_error "27" "save item failed.[$1,$2,$3]" "g10s"
            eval "${g10s_exitFun} 1"
        fi
        return 0
    }


    readonly g10s_saveSysConf_begin="###UltraPath modify begin,don't change this###"
    readonly g10s_saveSysConf_comment="###UltraPath comment it,don't change this###"
    readonly g10s_saveSysConf_end="###UltraPath modify end,don't change this###"

    g10s_saveSysConf_confName=""

    g10s_saveSysConf_itemAndValue=""
    function g10s_saveSysConf()
    {
        local tmpItem=""
        local iCount=0
        local i=0
        local tmpFile=""
        local tmpItem=""
        local tmpValue=""
        local ret=0

        if [ "${g10s_saveSysConf_confName}" = "" ] || [ "${g10s_saveSysConf_itemAndValue}" = "" ] || [ ${#g10s_saveSysConf_itemAndValue[@]} -le 1 ]
        then
            print_error "2" "param error." "g10s"
            g10s_saveSysConf_confName=""
            g10s_saveSysConf_itemAndValue=""
            eval "${g10s_exitFun} 1"
        fi


        if [ "${g10s_modifySysConfAuto}" = "0" ]
        then
            print_yesOrNo "36" "Is allowed to modify the system configuration?[${g10s_saveSysConf_confName}]" "g10s"
            if [ $? -ne 0 ]
            then
                print_warning "37" "you'd better modify those configuration by yourself." "g10s"
                iCount=${#g10s_saveSysConf_itemAndValue[@]}
                i=0
                for (( i=0; i<${iCount}; i=i+1))
                do
                    tmpItem="${g10s_saveSysConf_itemAndValue[${i}]}"
                    if [ "${tmpItem}" = "" ]
                    then

                        continue
                    fi
                    let "i=i+1"
                    tmpValue="${g10s_saveSysConf_itemAndValue[${i}]}"
                    print_event "37" "configuration.[file:${g10s_saveSysConf_confName},item:${tmpItem},value:${tmpValue}]" "g10s"
                done
                g10s_saveSysConf_confName=""
                g10s_saveSysConf_itemAndValue=""
                return 1
            fi
        fi


        if [ ! -f "${g10s_saveSysConf_confName}" ]
        then
            print_debug "sysconfig file not exist.touch it.[${g10s_saveSysConf_confName}]" "g10s"
            touch "$1"
            if [ $? -ne 0 ]
            then
                print_error "25" "create config file failed.[${g10s_saveSysConf_confName}]" "g10s"
                g10s_saveSysConf_confName=""
                g10s_saveSysConf_itemAndValue=""
                eval "${g10s_exitFun} 1"
            fi
        fi

        tmpFile="${g10s_tmpPath}/g10s_saveSysConf.tmp.$$"
        g10s_cp "${g10s_saveSysConf_confName}" "${tmpFile}"


        iCount=${#g10s_saveSysConf_itemAndValue[@]}
        i=0
        for (( i=0; i<${iCount}; i=i+1))
        do
            tmpItem="${g10s_saveSysConf_itemAndValue[${i}]}"
            if [ "${tmpItem}" = "" ]
            then

                continue
            fi
            let "i=i+1"
            tmpValue="${g10s_saveSysConf_itemAndValue[${i}]}"

            if [ `grep -E -c "^[[:blank:]]*${tmpItem}[[:blank:]]*=[[:blank:]]*${tmpValue}([[:blank:]#]+|$)" "${tmpFile}"` -ne 0 ]
            then
                print_debug "${tmpItem}=${tmpValue} has been exist." "g10s"
                continue
            fi

            print_event "39" "Modify system configuration.[file:${g10s_saveSysConf_confName},item:${tmpItem},value:${tmpValue}]" "g10s"

            ret=`grep -c "^[[:blank:]]*${tmpItem}[[:blank:]]*=" "${tmpFile}"`
            if [ ${ret} -eq 1 ]
            then
                ret=0
                if [ `grep -c "^[[:blank:]]*${g10s_saveSysConf_begin}${tmpItem}###" "${tmpFile}"` -ne 0 ]
                then
                    print_debug "UltraPath has modified ${tmpItem},try to replace it." "g10s"
                    sed -i "/^[[:blank:]]*${tmpItem}[[:blank:]]*=/s/^[^#]*/${tmpItem} = ${tmpValue}/" "${tmpFile}"
                    ret=$?
                else
                    print_debug "UltraPath first modify ${tmpItem}." "g10s"
                    sed -i "/^[[:blank:]]*${tmpItem}[[:blank:]]*=/s/^\(.*\)$/\
${g10s_saveSysConf_begin}${tmpItem}###\\
${g10s_saveSysConf_comment}\1\\
${tmpItem}=${tmpValue}\\
${g10s_saveSysConf_end}${tmpItem}###/" "${tmpFile}"
                       ret=$?
                    fi

                    if [ ${ret} -ne 0 ]
                    then
                        print_error "27" "save item failed.[${g10s_saveSysConf_confName},${tmpItem},${tmpValue}]" "g10s"
                        g10s_saveSysConf_confName=""
                    g10s_saveSysConf_itemAndValue=""
                        rm -f "${tmpFile}"
                    eval "${g10s_exitFun} 1"
                fi
            elif [ ${ret} -eq 0 ]
            then
                print_debug "not found ${tmpItem},try to append it." "g10s"
                echo "${g10s_saveSysConf_begin}${tmpItem}###
${tmpItem}=${tmpValue}
${g10s_saveSysConf_end}${tmpItem}###" >> "${tmpFile}"
                if [ $? -ne 0 ]
                then
                    print_error "27" "save item failed.[${g10s_saveSysConf_confName},${tmpItem},${tmpValue}]" "g10s"
                    g10s_saveSysConf_confName=""
                    g10s_saveSysConf_itemAndValue=""
                    rm -f "${tmpFile}"
                    eval "${g10s_exitFun} 1"
                fi
            else
                print_error "27" "there's more than one item found,save item failed.[${g10s_saveSysConf_confName},${tmpItem},${tmpValue}]" "g10s"
                g10s_saveSysConf_confName=""
                g10s_saveSysConf_itemAndValue=""
                rm -f "${tmpFile}"
                eval "${g10s_exitFun} 1"
            fi
       done
       g10s_cp "${tmpFile}" "${g10s_saveSysConf_confName}"
       g10s_saveSysConf_confName=""
       g10s_saveSysConf_itemAndValue=""
       rm -f "${tmpFile}"
       return 0
    }

    function g10s_rebackFromSysConf()
    {
        if [ "$1" = "" ]
        then
            print_error "2" "param error." "g10s"
            eval "${g10s_exitFun} 1"
        fi
        g10s_checkExist "-f" "$1" 2

        if [ "${g10s_modifySysConfAuto}" = "0" ]
        then
            print_yesOrNo "38" "we will recover system configuration?[$1]" "g10s"
            if [ $? -ne 0 ]
            then
                print_warning "37" "you'd better modify it by yourself.[$1,$2,$3]" "g10s"
                return 1
            fi
        fi

        local tmpFile="${g10s_tmpPath}/g10s_recoverSysConf.tmp.$$"
        local tmpItem=""
        if [ "$2" = "ALL" ] || [ "$2" = "" ]
        then
            tmpItem=".*"
        else
            tmpItem="$2"
        fi

        local iCount=`cat "${1}"|wc -l`
        local i=1
        local findBegin="0"
        local lineCount=0
        local hasLineRmoved="0"
        local lineMsg=""

        rm -f "${tmpFile}"
        touch "${tmpFile}"
        for (( i=1; i<=${iCount}; i=i+1 ))
        do
            lineMsg=`sed -n "${i}p" "$1"`
            if [ "${findBegin}" = "0" ] && [ `echo "${lineMsg}"|grep -c "^[[:blank:]]*${g10s_saveSysConf_begin}${tmpItem}###"` -eq 1 ]
            then
                findBegin="1"
                lineCount=1
                hasLineRmoved="1"
                continue
            fi

            if [ "${findBegin}" = "1" ]
            then
                if [ `echo "${lineMsg}"|grep -c "^[[:blank:]]*${g10s_saveSysConf_comment}"` -eq 1 ]
                then
                    echo "${lineMsg#*${g10s_saveSysConf_comment}}" >> "${tmpFile}"
                    continue
                fi

                let "lineCount=lineCount+1"
                if [ ${lineCount} -ge 6 ]
                then

                    print_error "35" "there's not found end flag in 6 lines after begin flag." "g10s"
                    eval "${g10s_exitFun} 1"
                fi
                if [ `echo "${lineMsg}"|grep -c "^[[:blank:]]*${g10s_saveSysConf_end}${tmpItem}###"` -eq 1 ]
                then
                    findBegin="0"
                fi
                continue
           fi

           echo "${lineMsg}" >> "${tmpFile}"
        done
        if [ "${hasLineRmoved}" = "1" ]
        then
            print_debug "tmpFile line count=`cat ${tmpFile}|wc -l`" "g10s"
            g10s_cp "${tmpFile}" "$1"
        fi
        rm -f "${tmpFile}"
        return 0
    }



    g10s_sysbit=""

    g10s_OSVersion=""

    g10s_OSReleaseFile=""

    g10s_allKernels="|"

    g10s_kernelType=""

    g10s_specUnamer=""

    g10s_supportOSVersion=( "SLES11SP0" "SLES11SP1" "SLES11SP2" "SLES11SP3" "SLES11SP4" \
                            "SLES12SP0" "SLES12SP1" "SLES12SP2" "SLES12SP3" "SLES12SP4" "SLES12SP5"\
                            "CentOS5" "CentOS6" \
                            "CentOS7" "CentOS7U1" "CentOS7U2" "CentOS7U3" "CentOS7U4" "CentOS7U5" "CentOS7U6" "CentOS7U7" "CentOS7U8" "CentOS7U9"\
                            "ASIANUX3" "ASIANUX4" "ASIANUX7U3" \
                            "KYLIN3SP0" "KYLIN3SP21" "KYLIN3SP22" "KYLIN3SP23" "KYLIN3SP24" "KYLIN3SP25" "KYLIN3SP28" "KYLIN3SP2_8" \
                            "KYLIN3SP3" "KYLIN3SP3_4" "KYLIN3SP3_6" "KYLIN6SP0" \
                            "KYLIN6SP5"  "KYLIN6SP7" "KYLIN6SP8" "KYLIN7SP0" "KYLIN7SP0_7U6" "KYLIN7SP2" "KYLIN7SP4"  "KYLIN7SP5" "KYLIN7SP6" \
                            "KYLIN10"  "KYLIN10SP2" "KYLIN10SP3" "KYLIN10_Azalea" \
                            "KYLINSEC3U4" "KYLINSEC3U3_6C" \
                            "UNIKYLIN3SP3" \
                            "UOS20SP1" "UOS20" \
                            "ISOFT3U0SP1" "ISOFT4SP0" \
                            "ROCKY_2.6.32.41" "ROCKY_2.6.27.54" "ROCKY_4.2.39" "ROCKY_4.2.40" \
                            "ROCKY_6.0.42" "ROCKY_6.0.42_700" "ROCKY6SP4" "ROCKY6SP6"  "ROCKY6SP7" "DEEPIN15" "ROCKY_6.0.60" "ROCKY_6.0.80" "ROCKY_6.0.80_8" "ROCKY_6.0.90" \
                            "OL5U6" "OL5U7" "OL5U8" "OL5U9" "OL5U10" "OL5U11" \
                            "OL6U0" "OL6U1" "OL6U2" "OL6U3" "OL6U4" "OL6U5" "OL6U6" "OL6U7"  "OL6U8"  "OL6U9" "OL6U10" \
                            "OL7U0" "OL7U1" "OL7U2" "OL7U3" "OL7U4" "OL7U5" "OL7U6" \
                            "UVPV2R5_7U3" "UVP3U0RC2_aarch64" "UVPV2R7_7U5" "UVP3U0_7U5" "UVP3U0RC7_aarch64" "UVP3U0_8U1" "UVPV2R10" "UVPV2R10_aarch64" "UVPV2R11_aarch64" "UVPV2R12_aarch64"   "UVPV2R12" "UVPHCE2" \
                            "EULEROS2SP2" "EULEROS2SP3" "EULEROS2SP5" "EULEROS2SP5SPC501" "EULEROS2SP8" "EULEROS2SP9_aarch64" "EULEROS2SP9_x86_64" "EULEROS2SP10_aarch64" "EULEROS2SP10_x86_64" "EULEROS2SP11_aarch64" "EULEROS2SP11_x86_64" "EULEROS2SP12_aarch64" "EULEROS2SP12_x86_64"\
                            "HCE2_x86_64" "CTyunOS2U0" "RockyLinux8U5" \
                            "NFS4U0" "NFSSEC" \
                            "OpenEuler20_03" "FusionOS22")

    function g10s_checkSupportOS()
    {
        local tmpVersion=""
        if [ "$1" = "" ]
        then
            print_error "2" "param error." "g10s"
            return 1
        fi
        for tmpVersion in "${g10s_supportOSVersion[@]}"
        do
            if [ "${tmpVersion}" = "$1" ]
            then
                return 0
            fi
        done
        print_error "33" "this system is not support.[${1}]" "g10s"
        return 1
    }


    function g10s_curUnamer()
    {
        g10s_use_os_cfg
        if [ $? -eq 0 ]; then
            echo "${G10S_INNER_UNAME_R}"
            return 0
        fi

        if [ -f "${g10s_ultraPathPackagesInfo}" ]
        then
            g10s_getConf "${g10s_ultraPathPackagesInfo}" "t400s_updateKernel"
            if [ "${g10s_confValue}" != "" ] && [ `cat "${g10s_ultraPathPackagesInfo}" | grep -c "^[[:blank:]]*t400s_updateKernel*"` -ne 0 ]
            then
                g10s_specUnamer=${g10s_confValue}
            fi
        fi
    
        if [ "${g10s_specUnamer}" = "" ]
        then
            echo "`uname -r 2>/dev/null`"
        else
            echo "${g10s_specUnamer}"
        fi
        return 0
    }

    function g10s_get_os_by_conf()
    {
        local cfg_mode=$1
        local os_shell="${G10S_CUR_OS_LIB_DIR}/g10s_${cfg_mode}.sh"
        local func_name="g10s_get_os_for_${cfg_mode}"

        if [ "${G10S_CUR_OS_LIB_DIR}" = "" ] || [ ! -f "${os_shell}" ]; then
            print_error "33" "${cfg_mode} shell [${os_shell}] not exist in g10s." "$0"
            return 1
        fi
        . "${os_shell}"

        eval "${func_name}"
        if [ $? -ne 0 ]; then
            return $?
        fi

        return 2
    }

    function __g10s_getOSForSuSE()
    {
        g10s_kernelType=""
        g10s_OSVersion=""
        g10s_checkExist -f "/etc/SuSE-release" 2
        local thisKernel=`g10s_curUnamer`
        local vernum=`cat /etc/SuSE-release | sed -n 's/^[[:blank:]]*VERSION[[:blank:]]*=[[:blank:]]*\([0-9][0-9]*\)[[:blank:]]*$/\1/p'`
        local verSP=`cat /etc/SuSE-release | sed -n 's/^[[:blank:]]*PATCHLEVEL[[:blank:]]*=[[:blank:]]*\([0-9][0-9]*\)[[:blank:]]*$/\1/p'`
        if [ "${verSP}" = "" ]
        then
            verSP=0
        fi
        if [ "${vernum}" != "" ]
        then
            g10s_kernelType=`echo "${thisKernel}" | awk -F "-" '{print $3}'|sed 's/[[:blank:]]//g'`
            g10s_OSVersion="SLES${vernum}SP${verSP}"
        fi
        if [ "${verSP}" = "2" ] && [ "${vernum}" = "9" ] && [ `echo ${thisKernel} | grep -c "201"` -ne 0 ]
        then
            g10s_OSVersion="SLES${vernum}SP${verSP}_201"
        fi

        return 0
    }

    function __g10s_getOSForAsianux()
    {
        g10s_kernelType=""
        g10s_OSVersion=""
        uVersion="" 
        local thisKernel=`g10s_curUnamer`
        print_debug "this is Asianux OS." "g10s"
        g10s_checkExist -f "/etc/asianux-release" 2
        if [ `cat /etc/asianux-release | grep -c "Asianux Server release 7"` -ne 0 ]
        then          
            uVersion=`cat /etc/asianux-release | awk -F "." '{print $2}' | awk -F " " '{print $1}'`
            g10s_OSVersion="ASIANUX7U${uVersion}"
            if [ ${g10s_OSVersion} != "ASIANUX7U3" ]
            then
                print_error "38" "unknown os version for Asianux 7." "g10s"
                return 1
            fi
            
            if [ `echo "${thisKernel}" |grep -c "axs7"` -eq 0 ]
            then
                print_error "38" "unknown kernel.[${thisKernel}]" "g10s"
                return 1
            fi
            g10s_kernelType=`echo "${thisKernel}"|awk -F "axs7" '{print $2}'`
            g10s_kernelType=${g10s_kernelType#.}
            g10s_kernelType=${g10s_kernelType#i686}
            g10s_kernelType=${g10s_kernelType#x86_64}
            g10s_kernelType=$(echo ${g10s_kernelType})
            if [ "${g10s_kernelType}" = "" ]
            then
                g10s_kernelType="normal"
            fi
            
        elif [ `cat /etc/asianux-release | grep -c "Asianux Server 4"` -ne 0 ]
        then
            g10s_OSVersion="ASIANUX4"
            if [ `echo "${thisKernel}" |grep -c "el6"` -eq 0 ]
            then
                print_error "38" "unknown kernel.[${thisKernel}]" "g10s"
               return 1
            fi
            g10s_kernelType=`echo "${thisKernel}"|awk -F "el6" '{print $2}'`
            g10s_kernelType=${g10s_kernelType#.}
            g10s_kernelType=${g10s_kernelType#i686}
            g10s_kernelType=${g10s_kernelType#x86_64}
            g10s_kernelType=$(echo ${g10s_kernelType})
            if [ "${g10s_kernelType}" = "" ]
            then
                g10s_kernelType="normal"
            fi
        elif [ `cat /etc/asianux-release | grep -c "Asianux Server 3"` -ne 0 ]
        then
            g10s_OSVersion="ASIANUX3"
            if [ `echo "${thisKernel}" |grep -c "AX"` -ne 0 ]
            then
                g10s_kernelType=`echo "${thisKernel}"|awk -F "AX" '{print $2}'`
                if [ `echo "${g10s_kernelType}" | grep -c "S3"` -ne 0 ]
                then
                    g10s_kernelType=`echo "${g10s_kernelType}"|awk -F "S3" '{print $2}'`
                fi

                if [ "${g10s_kernelType}" = "" ]
                then
                    g10s_kernelType="normal"
                fi
            else
                print_error "38" "unknown kernel.[${thisKernel}]" "g10s"
                return 1
            fi
        elif [ `cat /etc/asianux-release | grep -c "Asianux release 2.0"` -ne 0 ]
        then
            g10s_OSVersion="ASIANUX2"
            if [ `echo "${thisKernel}" |grep -c "AX"` -eq 1 ]
            then
                    g10s_kernelType=`echo "${thisKernel}"|awk -F "AX" '{print $2}'`
                    if [ `echo "${g10s_kernelType}"| grep -c "S2"` -ne 0 ]
                    then
                        g10s_kernelType=`echo "${g10s_kernelType}"|awk -F "S2" '{print $2}'`
                    fi
                if [ "${g10s_kernelType}" = "" ]
                then
                    g10s_kernelType="normal"
                fi
            elif [ `echo "${thisKernel}" |grep -c "EL"` -eq 1 ]
            then
                    g10s_kernelType=`echo "${thisKernel}"|awk -F "EL" '{print $2}'`
                    if [ "${g10s_kernelType}" = "" ]
                    then
                        g10s_kernelType="normal"
                    fi
            else
                    print_error "38" "unknown kernel.[${thisKernel}]" "g10s"
                    return 1
            fi
        fi

        return 0
    }

    function __g10s_getOSForOpenEuler()
    {
        g10s_kernelType=""
        g10s_OSVersion=""
        local year=""
        local month=""
        local thisKernel=""

        print_debug "this is openEuler OS." "g10s"
        g10s_checkExist -f "/etc/openEuler-release" 2
        year=$(cat /etc/openEuler-release | awk -F "." '{print $1}' | awk -F " " '{print $3}')
        month=$(cat /etc/openEuler-release | awk -F "." '{print $2}' | awk -F " " '{print $1}')
        g10s_OSVersion="OpenEuler${year}_${month}"
        g10s_kernelType="normal"

        return 0
    }

    function __g10s_getOSForCTyunOS()
    {
        g10s_kernelType=""
        g10s_OSVersion=""
        local max=""
        local min=""

        print_debug "this is CTyunOS OS." "g10s"
        g10s_checkExist -f "/etc/ctyunos-release" 2
        max=$(cat /etc/ctyunos-release | awk -F "." '{print $1}' | awk -F " " '{print $3}')
        min=$(cat /etc/ctyunos-release | awk -F "." '{print $2}')
        g10s_OSVersion="CTyunOS${max}U${min}"
        g10s_kernelType="normal"

        return 0
    }

    function __g10s_getOSForRockyLinux()
	{
		g10s_kernelType=""
        g10s_OSVersion=""
        local max=""
        local min=""
 
        print_debug "this is RockyLinux OS." "g10s"
        g10s_checkExist -f "/etc/rocky-release" 2
        max=$(cat /etc/rocky-release | awk -F "." '{print $1}' | awk -F " " '{print $4}')
        min=$(cat /etc/rocky-release | awk -F "." '{print $2}' | awk -F " " '{print $1}')
        g10s_OSVersion="RockyLinux${max}U${min}"
        g10s_kernelType="normal"
 
        return 0
	}

    function __g10s_getOSForFusion()
    {
        g10s_kernelType=""
        g10s_OSVersion=""
        local year=""

        print_debug "this is Fusion OS." "g10s"
        g10s_checkExist -f "/etc/FusionOS-release" 2
        year=$(cat /etc/FusionOS-release | awk -F "." '{print $1}' | awk -F " " '{print $3}')
        g10s_OSVersion="FusionOS${year}"
        g10s_kernelType="normal"

        return 0
    }

    function __g10s_getOSForCentOS()
    {
        g10s_kernelType=""
        g10s_OSVersion=""
        local thisKernel=`g10s_curUnamer`
        local centOSType=""
        print_debug "this is CentOS." "g10s"
        g10s_checkExist -f "/etc/redhat-release" 2
        local ret

        g10s_get_os_by_conf "centos8"
        ret=$?
        if [ $ret -eq 2 ]; then
            return $ret
        fi
        if [ $(cat /etc/redhat-release | grep -c -E "(Red Hat Enterprise Linux Server release 7|CentOS release 7|CentOS Linux release 7)") -ne 0 ]
        then
            uVersion=`cat /etc/redhat-release | awk -F "." '{print $2}' | awk -F " " '{print $1}'`
            if [ "${uVersion}" = "" ]
            then
                g10s_OSVersion="CentOS7U0"
            else
                g10s_OSVersion="CentOS7U${uVersion}"
            fi
        
            if [ ${g10s_OSVersion} == "CentOS7U0" ]
            then
                g10s_OSVersion="CentOS7"
            fi
        
            if [ `echo "${thisKernel}" |grep -c "el7"` -eq 0 ]
            then
                print_error "38" "unknown kernel.[${thisKernel}]" "g10s"
                return 1
            fi
        
            if [ `echo "${thisKernel}" | grep "el7a" | wc -l` -ne 0 ]
            then
                centOSType="el7a"
            else
                centOSType="el7"
            fi

            g10s_kernelType=`echo "${thisKernel}"|awk -F "${centOSType}" '{print $2}'`
            g10s_kernelType=${g10s_kernelType##*.}
            g10s_kernelType=${g10s_kernelType#i686}
            g10s_kernelType=${g10s_kernelType#x86_64}
            g10s_kernelType=$(echo ${g10s_kernelType})
            if [ "${uVersion}" != ""  ] && [ ${uVersion} -ge 5 ] && [ `echo "${g10s_kernelType}" |grep -c "aarch64"` -eq 1 ]
            then
                g10s_kernelType="aarch64"
            fi
            if [ "${g10s_kernelType}" = "" ]
            then
                g10s_kernelType="normal"
            fi

        elif [ `cat /etc/redhat-release | grep -c -E "(Red Hat Enterprise Linux Server release 6|CentOS release 6|CentOS Linux release 6)"` -ne 0 ]
        then
            g10s_supportOSuVersion=( "CentOS6U0" "CentOS6U1" "CentOS6U2" "CentOS6U3" "CentOS6U4" "CentOS6U5" \
                                     "CentOS6U6" "CentOS6U7" "CentOS6U8" "CentOS6U9" "CentOS6U10")
            uVersion=`cat /etc/redhat-release | awk -F "." '{print $2}' | awk -F " " '{print $1}'`
            if [ "${uVersion}" = "" ]
            then
                g10s_OSVersion="CentOS6U0"
            else
                g10s_OSVersion="CentOS6U${uVersion}"
            fi
            for tmpVersion in "${g10s_supportOSuVersion[@]}"
            do
                if [ "${tmpVersion}" = "${g10s_OSVersion}" ]
                then
                    g10s_OSVersion="CentOS6"
                    break
                fi
            done
            if [ `echo "${thisKernel}" |grep -c "el6"` -eq 0 ]
            then
                print_error "38" "unknown kernel.[${thisKernel}]" "g10s"
                eval "${g10s_exitFun} 1"
            fi
            g10s_kernelType=`echo "${thisKernel}"|awk -F "el6" '{print $2}'`
            g10s_kernelType=${g10s_kernelType#.}
            g10s_kernelType=${g10s_kernelType#i686}
            g10s_kernelType=${g10s_kernelType#x86_64}
            g10s_kernelType=$(echo ${g10s_kernelType})
            if [ "${g10s_kernelType}" = "" ]
            then
                g10s_kernelType="normal"
            fi
        elif [ `cat /etc/redhat-release | grep -c -E "(Red Hat Enterprise Linux Server release 5|CentOS release 5)"` -ne 0 ]
        then
            g10s_supportOSuVersion=( "CentOS5U0" "CentOS5U1" "CentOS5U2" "CentOS5U3" "CentOS5U4" "CentOS5U5" \
                                     "CentOS5U6" "CentOS5U7" "CentOS5U8" "CentOS5U9" "CentOS5U10" "CentOS5U11" )
            uVersion=`cat /etc/redhat-release | awk -F "." '{print $2}' | awk -F " " '{print $1}'`
            if [ "${uVersion}" = "" ]
            then
                g10s_OSVersion="CentOS5U0"
            else
                g10s_OSVersion="CentOS5U${uVersion}"
            fi
            for tmpVersion in "${g10s_supportOSuVersion[@]}"
            do
                if [ "${tmpVersion}" = "${g10s_OSVersion}" ]
                then
                    g10s_OSVersion="CentOS5"
                    break
                fi
            done
            if [ `echo "${thisKernel}" |grep -c "el5"` -eq 0 ]
            then
                print_error "38" "unknown kernel.[${thisKernel}]" "g10s"
                return 1
            fi
            g10s_kernelType=`echo "${thisKernel}"|awk -F "el5" '{print $2}'`
            if [ "${g10s_kernelType}" = "" ]
            then
                g10s_kernelType="normal"
            fi
        elif [ `cat /etc/redhat-release | grep -c -E "(Red Hat Enterprise Linux AS release 4|CentOS release 4)"` -ne 0 ]
        then
            g10s_supportOSuVersion=( "CentOS4U4" "CentOS4U5" "CentOS4U6" "CentOS4U7" "CentOS4U8")
            uVersion=`cat /etc/redhat-release | awk -F "." '{print $2}' | awk -F " " '{print $1}'`
            if [ "${uVersion}" = "" ]
            then
                uVersion=`cat /etc/redhat-release | awk -F " " '{print $10}' | awk -F ")" '{print $1}'`
                if [ "${uVersion}" = "" ]
                then
                    g10s_OSVersion="CentOS4U0"
                else
                    g10s_OSVersion="CentOS4U${uVersion}"
                fi
            else
                g10s_OSVersion="CentOS4U${uVersion}"
            fi
            for tmpVersion in "${g10s_supportOSuVersion[@]}"
            do
                if [ "${tmpVersion}" = "${g10s_OSVersion}" ]
                then
                    g10s_OSVersion="CentOS4"
                    break
                fi
            done
            if [ `echo "${thisKernel}" |grep -c "EL"` -eq 1 ]
            then
                g10s_kernelType=`echo "${thisKernel}"|awk -F "EL" '{print $2}'`
                if [ "${g10s_kernelType}" = "" ]
                then
                    g10s_kernelType="normal"
                fi
            elif [ `echo "${thisKernel}" |grep -c "AX"` -eq 1 ]
            then
                g10s_kernelType=`echo "${thisKernel}"|awk -F "AX" '{print $2}'`
                if [ `echo "${g10s_kernelType}"| grep -c "S2"` -ne 0 ]
                then
                    g10s_kernelType=`echo "${g10s_kernelType}"|awk -F "S2" '{print $2}'`
                fi
                if [ "${g10s_kernelType}" = "" ]
                then
                    g10s_kernelType="normal"
                fi
            else
                print_error "38" "unknown kernel.[${thisKernel}]" "g10s"
                return 1
            fi
        elif [ `cat /etc/redhat-release | grep -c -E "(Kylin release 3.0|Kylin release V3)"` -ne 0 ]
        then
            g10s_OSVersion="KYLIN3SP0"
            g10s_kernelType="normal"
        elif [ `cat /etc/redhat-release | grep -c "NeoKylin Linux Server release 3.2"` -ne 0 ] && [ `cat /etc/redhat-release | grep -c "NeoKylin 3.2.1"` -eq 0 ] && [ `cat /etc/redhat-release | grep -c "NeoKylin 3.2.2"` -eq 0 ]
        then
            if [ `echo "${thisKernel}" | grep -c "2.6.32.358"` -ne 0 ]
            then
                g10s_OSVersion="KYLIN3SP24"
                g10s_kernelType="normal"
            else
                g10s_OSVersion="KYLIN3SP23"
                g10s_kernelType="normal"
            fi
        
        
        elif [ `cat /etc/redhat-release | grep -c "KYLIN release 3"` -ne 0 ]        
        then
            if [ `echo "${thisKernel}" | grep -c "2.6.32.358"` -ne 0 ]
            then
                g10s_OSVersion="KYLIN3SP24"
                g10s_kernelType="normal"
            fi
            
            
        elif [ `cat /etc/redhat-release | grep -c "NeoKylin 3.2.1"` -ne 0 ]
        then
            g10s_OSVersion="KYLIN3SP21"
            g10s_kernelType="normal"
        elif [ `cat /etc/redhat-release | grep -c "NeoKylin 3.2.2"` -ne 0 ]
        then
            g10s_OSVersion="KYLIN3SP22"
            g10s_kernelType="normal"
        elif [ `cat /etc/redhat-release | grep -c "NeoKylin release 3.2"` -ne 0 ]
        then
            if [ `echo "${thisKernel}" | grep -c "2.6.32-642"` -ne 0 ]
            then
                g10s_OSVersion="KYLIN3SP28"
                g10s_kernelType="normal"
            else
                g10s_OSVersion="KYLIN3SP25"
                g10s_kernelType="normal"
            fi
        elif [ $(cat /etc/redhat-release | grep -c "Kylin release 3.2") -ne 0 ]
        then
            if [ $(echo "${thisKernel}" | grep -c "2.6.32-642") -ne 0 ]
            then
                g10s_OSVersion="KYLIN3SP28"
                g10s_kernelType="normal"
            fi
            if [ $(echo "${thisKernel}" | grep -c "2.6.32-754") -ne 0 ]
            then
                g10s_OSVersion="KYLIN3SP2_8"
                g10s_kernelType="normal"
            fi
        elif [ $(cat /etc/redhat-release |grep -c "UniKylin Linux release 3(Core)") -ne 0 ]
        then
            if [ $(echo "${thisKernel}" | grep -c "4.19.90") -ne 0 ]
            then
                g10s_OSVersion="UNIKYLIN3SP3"
                g10s_kernelType="normal"
            fi
            if [ $(echo "${thisKernel}" | grep -c "3.10.0-1062") -ne 0 ]
            then
                g10s_OSVersion="KYLIN3SP3_6"
                g10s_kernelType="normal"
            fi  
        elif [ `cat /etc/redhat-release |grep -c "Kylin Linux release 3"` -ne 0 ]
        then
            if [ `echo "${thisKernel}" | grep -c "3.10.0-514"` -ne 0 ] && [ `cat /etc/redhat-release | grep -c "Kylin Linux release 3.3"` -ne 0 ]
            then
                g10s_OSVersion="KYLIN3SP3"
                g10s_kernelType="normal"
            fi

            if [ `echo "${thisKernel}" | grep -c "3.10.0-957"` -ne 0 ]
            then
                g10s_OSVersion="KYLIN3SP3_4"
                g10s_kernelType="normal"
            fi
        elif [ $(cat /etc/redhat-release |grep -c "KylinSec OS Linux release 3(Core)") -ne 0 ]
        then
            if [ $(echo "${thisKernel}" | grep -c "3.10.0-1062") -ne 0 ]
            then
                g10s_OSVersion="KYLINSEC3U3_6C"
                g10s_kernelType="normal"
            fi
        fi

        if [ "${g10s_OSVersion}" = "" ]; then
            print_debug "Unknown OS, OS_RELEASE=$(cat /etc/redhat-release), Unamer=$(g10s_curUnamer) g10s" "$0"
        fi
        return 0
    }

    function __g10s_getOSForUVP()
    {
        local thisKernel=`g10s_curUnamer`


        if [ -f /etc/UVP-release  ] && [ -f /etc/uvp_version ]
        then
            if [ `cat "/etc/uvp_version" | grep "uvp_version" | grep -c "V100R002"` -eq 1 ]
            then
                g10s_OSVersion="UVPV1R2"
                g10s_kernelType=`echo "${thisKernel}" | awk -F "-" '{print $3}'|sed 's/[[:blank:]]//g'`
            elif [ `cat "/etc/uvp_version" | grep "uvp_version" | grep -c "V100R003"` -eq 1 ]
            then
                g10s_OSVersion="UVPV1R3"
                g10s_kernelType=`echo "${thisKernel}" | awk -F "-" '{print $3}'|sed 's/[[:blank:]]//g'`
            fi

        elif [ -f /etc/uvp_version ] && [ -f /etc/SuSE-release ] && [ `cat "/etc/SuSE-release" | grep "PATCHLEVEL" | grep -c "3"` -eq 1 ]
        then
            g10s_kernelType=`echo "${thisKernel}" | awk -F "-" '{print $3}'|sed 's/[[:blank:]]//g'`
            g10s_OSVersion="UVPSP3"

        elif [ -f /etc/redhat-release ] && [ `cat "/etc/redhat-release" | grep -c "EulerOS V2.0SP1"` -gt 0 ]
        then
            if [ `echo "${thisKernel}" |grep -c "4.1.38-05.34.vhulk1702.1.1"` -eq 0 ]
            then
                g10s_OSVersion="UVPV2R3"
                g10s_kernelType="normal"
            fi
        elif [ -f /etc/uvp_version ] && [ -f /etc/redhat-release ] && [ `cat "/etc/redhat-release" | grep -c "EulerOS release 2.0 (SP3)"` -gt 0 ]
        then
            if [ `echo "${thisKernel}" | grep -c "3.10.0-514"` -ne 0 ]
            then
                g10s_OSVersion="UVPV2R5_7U3"
                g10s_kernelType="normal"
            fi
        elif  [ -f /etc/uvp_version ] && [ -f /etc/hce-release ] && [ $(cat /etc/hce-release | grep -c "Huawei Cloud EulerOS release 2.0 (West Lake)") -gt 0 ]
        then
            if [ $(echo "${thisKernel}" | grep -c "5.10.0-.*.x86_64") -ne 0 ]
            then
                g10s_OSVersion="UVPHCE2"
                g10s_kernelType="normal"
            fi
        elif [ -f /etc/uvp_version ] && [ -f /etc/euleros-release ] && [ `cat "/etc/euleros-release" | grep -c "EulerOS release 2.0 (SP5)"` -gt 0 ]
        then
            if [ `echo "${thisKernel}" | grep -c "3.10.0-862.*.eulerosv2r7.x86_64"` -ne 0 ]
            then
                g10s_OSVersion="UVPV2R7_7U5"
                g10s_kernelType="normal"
            elif [ `echo "${thisKernel}" | grep -c "3.10.0-862.*.x86_64"` -ne 0 ]
            then
                g10s_OSVersion="UVP3U0_7U5"
                g10s_kernelType="normal"
            fi
        elif [ -f /etc/uvp_version ] && [ -f /etc/euleros-release ] && [ `cat "/etc/euleros-release" | grep -c "EulerOS release 2.0 (SP8)"` -gt 0 ]
        then
            if [ `echo "${thisKernel}" | grep -c "4.19.36-.*.aarch64"` -ne 0 ]
            then
                g10s_OSVersion="UVP3U0RC2_aarch64"
                g10s_kernelType="normal"
            fi
        elif [ -f /etc/uvp_version ] && [ -f /etc/euleros-release ] && [ $(cat "/etc/euleros-release" | grep -c "EulerOS release 2.0 (SP9x86_64)") -gt 0 ]
        then
            if [ $(echo "${thisKernel}" | grep -c "4.18.0-147.*.x86_64") -ne 0 ]
            then
                g10s_OSVersion="UVP3U0_8U1"
                g10s_kernelType="normal"
            fi
        elif [ `cat /etc/issue | grep "SUSE" | grep -c "11 SP2"` -gt 0 ] && [ `rpm -qa | grep -c "UVP_Compile_Tool_V1R2"` -gt 0 ]
        then
            g10s_OSVersion="UVPV1R2"
            g10s_kernelType=`echo "${thisKernel}" | awk -F "-" '{print $3}'|sed 's/[[:blank:]]//g'`

        elif [ `cat /etc/issue | grep "SUSE" | grep -c "11 SP2"` -gt 0 ] && [ `rpm -qa | grep -c "UVP_Compile_Tool_V1R3"` -gt 0 ]
        then
            g10s_OSVersion="UVPV1R3"
            g10s_kernelType=`echo "${thisKernel}" | awk -F "-" '{print $3}'|sed 's/[[:blank:]]//g'`

        elif [ -f /etc/uvp_version ] && [ -f /etc/euleros-release ] && [ $(cat "/etc/euleros-release" | grep -c "EulerOS release 2.0 (SP9)") -gt 0 ] 
        then 
            if [ $(echo "${thisKernel}" | grep -c "4.19.90-.*.aarch64") -ne 0 ] 
            then 
                g10s_OSVersion="UVP3U0RC7_aarch64" 
                g10s_kernelType="normal" 
            fi 
        elif  [ -f /etc/uvp_version ] && [ -f /etc/euleros-release ] && [ $(cat "/etc/euleros-release" | grep -c "EulerOS release 2.0 (SP10)") -gt 0 ]
        then
            if [ $(echo "${thisKernel}" | grep -c "4.19.90-.*.aarch64") -ne 0 ]
            then
                g10s_OSVersion="UVPV2R10_aarch64"
                g10s_kernelType="normal"
            fi
        elif  [ -f /etc/uvp_version ] && [ -f /etc/euleros-release ] && [ $(cat "/etc/euleros-release" | grep -c "EulerOS release 2.0 (SP10x86_64)") -gt 0 ]
        then
            if [ $(echo "${thisKernel}" | grep -c "4.18.0-147.*.x86_64") -ne 0 ]
            then
                g10s_OSVersion="UVPV2R10"
                g10s_kernelType="normal"
            fi
        elif  [ -f /etc/uvp_version ] && [ -f /etc/euleros-release ] && [ $(cat "/etc/euleros-release" | grep -c "EulerOS release 2.0 (SP11)") -gt 0 ]
        then
            if [ $(echo "${thisKernel}" | grep -c "5.10.0-.*.aarch64") -ne 0 ]
            then
                g10s_OSVersion="UVPV2R11_aarch64"
                g10s_kernelType="normal"
            fi 
        elif  [ -f /etc/uvp_version ] && [ -f /etc/euleros-release ] && [ $(cat "/etc/euleros-release" | grep -c "EulerOS release 2.0 (SP12)") -gt 0 ]
        then
            if [ $(echo "${thisKernel}" | grep -c "5.10.0-.*.aarch64") -ne 0 ]
            then
                g10s_OSVersion="UVPV2R12_aarch64"
                g10s_kernelType="normal"
            fi 
        elif  [ -f /etc/uvp_version ] && [ -f /etc/euleros-release ] && [ $(cat "/etc/euleros-release" | grep -c "EulerOS release 2.0 (SP12x86_64)") -gt 0 ]
        then
            if [ $(echo "${thisKernel}" | grep -c "5.10.0-.*.x86_64") -ne 0 ]
            then
                g10s_OSVersion="UVPV2R12"
                g10s_kernelType="normal"
            fi
        fi 

        if [ -f /boot/grub/menu.lst ] && [ `cat /boot/grub/menu.lst | grep -c "^[[:blank:]]*title[[:blank:]].*UVP.*V100R001C03"` -ne 0 ]
        then
            g10s_OSVersion="UVPV1R1C03"
            g10s_kernelType=`g10s_curUnamer | awk -F "-" '{print $3}'|sed 's/[[:blank:]]//g'`
        fi
        return 0
    }

    function __g10s_getOSForOracleLinux()
    {
        g10s_kernelType=""
        g10s_OSVersion=""
        local thisKernel=`g10s_curUnamer`
        g10s_checkExist -f "/etc/oracle-release" 2
        if [ `cat /etc/oracle-release | grep -c "Oracle Linux Server release 6"` -ne 0 ]
        then
	        uVersion=`cat /etc/oracle-release | awk -F "." '{print $2}'`
	        if [ "${uVersion}" = "" ]
	        then
	            g10s_OSVersion="OL6U0"
	        else
	            g10s_OSVersion="OL6U${uVersion}"
	        fi
	        if [ "${g10s_sysbit}" == "i386" ] && [ `echo ${g10s_OSVersion} | grep -E -c "OL6U3|OL6U9"` -ne 0 ]
	        then
	            print_error "38" "unknown kernel.[${thisKernel}]" "g10s"
	            return 1
	        fi
	        if [ `echo "${thisKernel}" |grep -c "el6"` -eq 0 ]
	        then
	            print_error "38" "unknown kernel.[${thisKernel}]" "g10s"
                return 1
	        fi
        	g10s_kernelType=`echo "${thisKernel}"|awk -F "el6" '{print $2}'`
	        if [ `echo "${g10s_kernelType}" | grep -c "uek"` -ne 0 ]
	        then
		        if [ "${g10s_OSVersion}" = "OL6U3" ] && [ "`echo "${thisKernel}"`" = "2.6.39-400.21.1.el6uek.di.x86_64" ]
			then
		             g10s_kernelType="uekdi"
			else
	                    g10s_kernelType="uek"
			fi
	        else
		        g10s_kernelType=${g10s_kernelType#.}
		        g10s_kernelType=${g10s_kernelType#i686}
		        g10s_kernelType=${g10s_kernelType#x86_64}
		        g10s_kernelType=$(echo ${g10s_kernelType})
		        if [ "${g10s_kernelType}" = "" ]
		        then
		                if [ `echo "${thisKernel}" | grep -c "2.6.32-100.28.5"` -ne 0 ]
		                then
		                g10s_kernelType="uek"
		            	else
		                	g10s_kernelType="normal"
		            	fi
		        fi
            	fi
    	elif [ `cat /etc/oracle-release | grep -c "Oracle Linux Server release 5"` -ne 0 ]
    	then
	        uVersion=`cat /etc/oracle-release | awk -F "." '{print $2}'`
	        if [ "${uVersion}" = "" ]
	        then
	            g10s_OSVersion="OL5U0"
	        else
	            g10s_OSVersion="OL5U${uVersion}"
	        fi

	        if [ `echo "${thisKernel}" |grep -c "el5"` -eq 0 ]
	        then
	            print_error "38" "unknown kernel.[${thisKernel}]" "g10s"
	            eval "${g10s_exitFun} 1"
	        fi
	        g10s_kernelType=`echo "${thisKernel}"|awk -F "el5" '{print $2}'`
	        if [ "${g10s_kernelType}" = "" ]
	        then
	            if [ `echo "${thisKernel}"|awk -F "-" '{print $1}'` = "2.6.32" ]
	            then
	                g10s_kernelType="uek"
	            else
	                g10s_kernelType="normal"
	            fi
	        fi
		elif [ `cat /etc/oracle-release | grep -c "Oracle Linux Server release 7"` -ne 0 ]
    	then
	        uVersion=`cat /etc/oracle-release | awk -F "." '{print $2}'`
	        if [ "${uVersion}" = "" ]
	        then
	            g10s_OSVersion="OL7U0"
	        else
	            g10s_OSVersion="OL7U${uVersion}"
	        fi
	        if [ `echo "${thisKernel}" |grep -c "el7"` -eq 0 ]
	        then
	            print_error "38" "unknown kernel.[${thisKernel}]" "g10s"
                return 1
	        fi
	        g10s_kernelType=`echo "${thisKernel}"|grep "uek"`
	        if [ "${g10s_kernelType}" != "" ]
	        then
	                g10s_kernelType="uek"
	            else
	                g10s_kernelType="normal"
	        fi
   	fi

    	return 0
    }

    function __g10s_getOSForROCKY4SP2()
    {
       if [ `cat /etc/issue | grep "4.2.35" |wc -l` -ne 0 ]
       then
           g10s_OSVersion="ROCKY_`g10s_curUnamer | awk -F "-" '{print $1}'|sed 's/[[:blank:]]//g'`"
       elif [ `cat /etc/issue | grep -E "4.2.39" |wc -l` -ne 0 ]
       then
           g10s_OSVersion="ROCKY_4.2.39"
       elif [ `cat /etc/issue | grep -E "4.2.40" |wc -l` -ne 0 ]
       then
           g10s_OSVersion="ROCKY_4.2.40"
       elif [ `cat /etc/issue | grep -E "6.0.42" |wc -l` -ne 0 ]
       then
           if [ `uname -r|grep -c "2.6.32.700"` -ne 0 ]
           then
               g10s_OSVersion="ROCKY_6.0.42_700"
           else
               g10s_OSVersion="ROCKY_6.0.42"
           fi
       fi
       return 0
    }

    function __g10s_getOSForUOS()
    {
        local thisKernel=$(g10s_curUnamer)
        if [ $(cat /etc/os-release | grep -c "uos 20 SP1") -eq 1 ]; then
            g10s_OSVersion="UOS20SP1"
        elif [ $(cat /etc/os-release | grep -c "UnionTech OS Server 20 Enterprise") -ne 0 ]; then
            g10s_OSVersion="UOS20"
        else
            print_error "38" "unknown kernel.[${thisKernel}]" "g10s"
            return 1
        fi
        return 0
    }
    
    function g10s_getUVPTypeOnlineForUVPSP3()
    {
        local thisKernel=`g10s_curUnamer`

        g10s_OSVersion="UVPSP3"
        g10s_kernelType=`echo "${thisKernel}" | awk -F "-" '{print $3}'|sed 's/[[:blank:]]//g'`
    }

    function g10s_getUVPTypeOnlineForUVPV2R3()
    {
        g10s_OSVersion="UVPV2R3"
        g10s_kernelType="normal"
    }
    
    function g10s_getUVPTypeOnlineForUVP3U0_8U1()
    {
        g10s_OSVersion="UVP3U0_8U1"
        g10s_kernelType="normal"
    }

    function g10s_getUVPTypeOnlineForUVPV2R10()
    {
        g10s_OSVersion="UVPV2R10"
        g10s_kernelType="normal"
    }

    function g10s_getUVPTypeOnlineForUVPHCE2()
    {
        g10s_OSVersion="UVPHCE2"
        g10s_kernelType="normal"
    }

    function g10s_getUVPTypeOnlineForUVPV2R5_7U3()
    {
        g10s_OSVersion="UVPV2R5_7U3"
        g10s_kernelType="normal"
    }

    function g10s_getUVPTypeOnlineForUVPV2R7_7U5()
    {
        g10s_OSVersion="UVPV2R7_7U5"
        g10s_kernelType="normal"
    }    

    function g10s_getUVPTypeOnlineForUVP3U0_7U5()
    {
        g10s_OSVersion="UVP3U0_7U5"
        g10s_kernelType="normal"
    }
    
    function g10s_getUVPTypeOnlineForUVPV2R10_aarch64()
    {
        g10s_OSVersion="UVPV2R10_aarch64"
        g10s_kernelType="normal"
    }

    function g10s_getUVPTypeOnlineForUVPV2R11_aarch64()
    {
        g10s_OSVersion="UVPV2R11_aarch64"
        g10s_kernelType="normal"
    }

    function g10s_getUVPTypeOnlineForUVPV2R12_aarch64()
    {
        g10s_OSVersion="UVPV2R12_aarch64"
        g10s_kernelType="normal"
    }

    function g10s_getUVPTypeOnlineForUVPV2R12()
    {
        g10s_OSVersion="UVPV2R12"
        g10s_kernelType="normal"
    }

    function g10s_getUVPTypeOnlineForUVP3U0RC2_aarch64()
    {
        g10s_OSVersion="UVP3U0RC2_aarch64"
        g10s_kernelType="normal"
    }

    function g10s_getUVPTypeOnlineForUVP3U0RC7_aarch64()
    {
        g10s_OSVersion="UVP3U0RC7_aarch64"
        g10s_kernelType="normal"
    }

    function __g10s_getOSForKylin()
    {
        g10s_kernelType=""
        g10s_OSVersion=""
        local thisKernel=$(g10s_curUnamer)
        print_debug "this is Kylin OS." "g10s"
        g10s_checkExist -f "/etc/kylin-release" 2
        if [ $(cat /etc/kylin-release | grep -c "Kylin Linux Advanced Server release V10 (Tercel)") -ne 0 ]
        then
            g10s_OSVersion="KYLIN10"
            g10s_kernelType="normal"
        elif [ $(cat /etc/kylin-release | grep -c "Kylin Linux Advanced Server release V10 (Sword)") -ne 0 ]
        then
            g10s_OSVersion="KYLIN10SP2"
            g10s_kernelType="normal"
        elif [ $(cat /etc/kylin-release | grep -c "Kylin Linux Advanced Server release V10 (Lance)") -ne 0 ]
        then
            g10s_OSVersion="KYLIN10SP3"
            g10s_kernelType="normal"
        elif [ $(cat /etc/kylin-release | grep -c "Kylin Linux Advanced Server release V10 (Azalea)") -ne 0 ]
        then
            g10s_OSVersion="KYLIN10_Azalea"
            g10s_kernelType="normal"
        elif [ $(cat /etc/kylin-release | grep -c "KylinSec OS Linux release 3.4 (Core)") -ne 0 ]
        then
            g10s_OSVersion="KYLINSEC3U4"
            g10s_kernelType="normal"
        else
            print_error "38" "unknown kernel.[${thisKernel}]" "g10s"
            return 1
        fi
    	return 0
    }
    
    function __g10s_getOSForNeoKylin()
    {
        g10s_kernelType=""
        g10s_OSVersion=""
        local thisKernel=`g10s_curUnamer`
        print_debug "this is neokylin OS." "g10s"
        g10s_checkExist -f "/etc/neokylin-release" 2
        if [ `cat /etc/neokylin-release | grep -c "NeoKylin Linux Advanced Server release 6.5"` -ne 0 ]
        then
            g10s_OSVersion="KYLIN6SP5"
            g10s_kernelType="normal"
        elif [ `cat /etc/neokylin-release | grep -c "NeoKylin Linux Advanced Server release 6.7"` -ne 0 ]
        then
            g10s_OSVersion="KYLIN6SP7"
            g10s_kernelType="normal"  
        elif [ `cat /etc/neokylin-release | grep -c "NeoKylin Linux Advanced Server release V7Update2"` -ne 0 ]
        then
            g10s_OSVersion="KYLIN7SP2"
            g10s_kernelType="normal"  
        elif [ `cat /etc/neokylin-release | grep -c "NeoKylin Linux Advanced Server release V7Update4"` -ne 0 ]
        then
            g10s_OSVersion="KYLIN7SP4"
            g10s_kernelType="normal" 
        elif [ `cat /etc/neokylin-release | grep -c "NeoKylin Linux Advanced Server release V7Update5"` -ne 0 ] && [ `uname -a |grep -c aarch64` -ne 0 ]
        then
            g10s_OSVersion="KYLIN7SP5"
            g10s_kernelType="normal" 
        elif [ $(cat /etc/neokylin-release |grep -c -E "^NeoKylin Linux Advanced Server release (V7.0|V7Update6) \(Chromium\)$") -ne 0 ] && [ $(uname -a |grep -c aarch64) -ne 0 ]
        then
            if [ $(uname -r | grep -c 4.14.0-115.5.1.el7a.08.aarch64) -ne 0 ]
            then
                g10s_OSVersion="KYLIN7SP0_7U6"
            else
                g10s_OSVersion="KYLIN7SP6"
            fi
            g10s_kernelType="normal"
        elif [ $(cat /etc/neokylin-release | grep -c "NeoKylin Linux Advanced Server release V7Update6 (Chromium)") -ne 0 ] && [ $(uname -a | grep -c x86_64) -ne 0 ]
        then
            g10s_OSVersion="KYLIN7SP6"
            g10s_kernelType="normal"
        elif [ `cat /etc/neokylin-release | grep -c "NeoKylin Linux Trusted OS V6.0"` -ne 0 ]
        then
            g10s_OSVersion="KYLIN6SP0"
            g10s_kernelType="normal"  		
        elif [ `cat /etc/neokylin-release | grep -c "NeoKylin Linux Advanced Server release 6.8"` -ne 0 ]
        then
            g10s_OSVersion="KYLIN6SP8"
            g10s_kernelType="normal"  
        elif [ `cat /etc/neokylin-release | grep -c "NeoKylin Linux Security OS V7.0 (Final)"` -ne 0 ]
        then
            g10s_OSVersion="KYLIN7SP0"
            g10s_kernelType="normal"  
        elif [ $(cat /etc/neokylin-release | grep -c "NeoKylin Linux Advanced Server release V7.0 (Chromium)") -ne 0 ] && [ $(uname -a |grep -c x86_64) -ne 0 ]
        then
            g10s_OSVersion="KYLIN7SP0_7U6"
            g10s_kernelType="normal"
        else
            print_error "38" "unknown kernel.[${thisKernel}]" "g10s"
            return 1
        fi

        return 0
    }
    
    function __g10s_getOSForISoft()
    {
        g10s_kernelType=""
        g10s_OSVersion=""
        local thisKernel=`g10s_curUnamer`
        print_debug "this is iSoft OS." "g10s"
        g10s_checkExist -f "/etc/isoft-release" 2
        if [ `cat /etc/isoft-release | grep -c "iSoft Server OS release 3.0 SP1"` -ne 0 ]
    	then
            g10s_OSVersion="ISOFT3U0SP1"
            g10s_kernelType="normal"
        elif [ `cat /etc/isoft-release | grep -c "iSoft Linux release 4.0"` -ne 0 ]
        then
            g10s_OSVersion="ISOFT4SP0"
            g10s_kernelType="normal"            
        else
            print_error "38" "unknown kernel.[${thisKernel}]" "g10s"
            return 1
        fi

    	return 0
    }
	
    function __g10s_getOSForEulerOS()
    {
        local hVersionStr=""
        g10s_kernelType=""
        g10s_OSVersion=""
        local thisKernel=`g10s_curUnamer`
        print_debug "this is Euler OS." "g10s"
        g10s_checkExist -f "/etc/euleros-release" 2
        if [ `cat /etc/euleros-release | grep -c "EulerOS release 2.0 (SP2)"` -ne 0 ]
        then
            g10s_OSVersion="EULEROS2SP2"
            g10s_kernelType="normal"
        fi
        if [ `echo "${thisKernel}" | grep -c "4.1.38-05.34.vhulk1702.1.1"` -ne 0 ]
        then
            g10s_OSVersion="EULEROS2SP2"
            g10s_kernelType="normal"
        fi
        if [ `cat /etc/euleros-release | grep -c "EulerOS release 2.0 (SP3)"` -ne 0 ] && [ ! -f /etc/uvp_version ]
        then
            g10s_OSVersion="EULEROS2SP3"
            g10s_kernelType="normal"
        fi

        if [ `cat /etc/euleros-release | grep -c "EulerOS release 2.0 (SP5)"` -ne 0 ] && [ ! -f /etc/uvp_version ]
        then
            hVersionStr=`echo "${thisKernel}" | awk -F "." '{print $7}' | sed -e 's/h//g'`
            local hVersion=`expr ${hVersionStr} + 0`
            if [ ${hVersion} -le 80 ]
            then
                g10s_OSVersion="EULEROS2SP5"
                g10s_kernelType="normal"
            elif [ ${hVersion} -ge 105 ]
            then
                g10s_OSVersion="EULEROS2SP5SPC501"
                g10s_kernelType="normal"
            fi
        fi

        if [ `cat /etc/euleros-release | grep -c "EulerOS release 2.0 (SP8)"` -ne 0 ] && [ ! -f /etc/uvp_version ]
        then
            if [ `echo "${thisKernel}" | grep -c "aarch64"` -ne 0 ]
            then
                g10s_OSVersion="EULEROS2SP8"
                g10s_kernelType="normal"
            fi
        fi

        if [ $(cat /etc/euleros-release | grep -c "EulerOS release 2.0 (SP9)") -ne 0 ] && [ ! -f /etc/uvp_version ]
        then
            if [ $(echo "${thisKernel}" | grep -c "aarch64") -ne 0 ]
            then
                g10s_OSVersion="EULEROS2SP9_aarch64"
                g10s_kernelType="normal"
            fi
        fi

        if [ $(cat /etc/euleros-release | grep -c "EulerOS release 2.0 (SP9x86_64)") -ne 0 ] && [ ! -f /etc/uvp_version ]
        then
            g10s_OSVersion="EULEROS2SP9_x86_64"
            g10s_kernelType="normal"
        fi

        if [ $(cat /etc/euleros-release | grep -c "EulerOS release 2.0 (SP10)") -ne 0 ] && [ ! -f /etc/uvp_version ]
        then
            if [ $(echo "${thisKernel}" | grep -c "aarch64") -ne 0 ]
            then
                g10s_OSVersion="EULEROS2SP10_aarch64"
                g10s_kernelType="normal"
            fi
        fi

        if [ $(cat /etc/euleros-release | grep -c "EulerOS release 2.0 (SP10x86_64)") -ne 0 ] && [ ! -f /etc/uvp_version ]
        then
            g10s_OSVersion="EULEROS2SP10_x86_64"
            g10s_kernelType="normal"
        fi

        if [ $(cat /etc/euleros-release | grep -c "EulerOS release 2.0 (SP11)") -ne 0 ] && [ ! -f /etc/uvp_version ]
        then
            if [ $(echo "${thisKernel}" | grep -c "aarch64") -ne 0 ]
            then
                g10s_OSVersion="EULEROS2SP11_aarch64"
                g10s_kernelType="normal"
            fi
        fi

        if [ $(cat /etc/euleros-release | grep -c "EulerOS release 2.0 (SP11x86_64)") -ne 0 ] && [ ! -f /etc/uvp_version ]
        then
            g10s_OSVersion="EULEROS2SP11_x86_64"
            g10s_kernelType="normal"
        fi

        if [ $(cat /etc/euleros-release | grep -c "EulerOS release 2.0 (SP12)") -ne 0 ] && [ ! -f /etc/uvp_version ]
        then
            if [ $(echo "${thisKernel}" | grep -c "aarch64") -ne 0 ]
            then
                g10s_OSVersion="EULEROS2SP12_aarch64"
                g10s_kernelType="normal"
            fi
        fi

        if [ $(cat /etc/euleros-release | grep -c "EulerOS release 2.0 (SP12x86_64)") -ne 0 ] && [ ! -f /etc/uvp_version ]
        then
            g10s_OSVersion="EULEROS2SP12_x86_64"
            g10s_kernelType="normal"
        fi
        return 0
    }

    function __g10s_getOSForHCE()
    {
        local hVersionStr=""
        g10s_kernelType=""
        g10s_OSVersion=""
        local thisKernel="$(g10s_curUnamer)"
        print_debug "this is HCE OS." "g10s"
        g10s_checkExist -f "/etc/hce-release" 2
        if [ $(cat /etc/hce-release | grep -c "Huawei Cloud EulerOS release 2.0 (West Lake)") -ne 0 ] && [ ! -f /etc/uvp_version ]
        then
            g10s_OSVersion="HCE2_x86_64"
            g10s_kernelType="normal"
        fi

        return 0
    }

    function __g10s_getOSForRocky6()
    {
        g10s_kernelType="$(g10s_curUnamer | awk -F "-" '{print $4}'| sed 's/[[:blank:]]//g')"
        if [ $(cat /etc/issue | grep "6.0.60.4" | wc -l) -ne 0 ] || [ $(cat /etc/issue | grep "6.0.3" | wc -l) -ne 0 ]
        then
           g10s_OSVersion="ROCKY`cat /etc/debian_version|awk -F "." '{print $1}'`SP`cat /etc/debian_version|awk -F "." '{print $3}'`"
        elif [ $(cat /etc/issue | grep "6.0.60" | wc -l) -ne 0 ] && [ $(g10s_curUnamer | grep "2.6.32-696" | wc -l) -ne 0 ]
        then
            g10s_OSVersion="ROCKY_6.0.60"
        elif [ $(cat /etc/issue | grep "6.0.80" | wc -l) -ne 0 ] && [ $(g10s_curUnamer | grep "4.9.0-0.bpo.1" | wc -l) -ne 0 ]
        then
            g10s_kernelType="$(g10s_curUnamer | awk -F "-" '{print $5}' | sed 's/[[:blank:]]//g')"
            g10s_OSVersion="ROCKY_6.0.80"
        elif [ $(cat /etc/issue | grep "6.0.80" | wc -l) -ne 0 ] && [ $(g10s_curUnamer | grep "4.9.0-8" | wc -l) -ne 0 ]
        then
            g10s_kernelType="$(g10s_curUnamer | awk -F "-" '{print $5}' | sed 's/[[:blank:]]//g')"
            g10s_OSVersion="ROCKY_6.0.80_8"
        elif [ $(cat /etc/issue | grep "6.0.90" | wc -l) -ne 0 ] && [ $(g10s_curUnamer | grep "4.19.0-0.bpo.1" | wc -l) -ne 0 ]
        then
            g10s_kernelType="$(g10s_curUnamer | awk -F "-" '{print $5}' | sed 's/[[:blank:]]//g')"
            g10s_OSVersion="ROCKY_6.0.90"
        fi
    }

    function getOSForNFS()
    {
        if [ $(cat /etc/nfs-release | grep "NFS Server release 4.0.200717 (RTM1)" | wc -l) -ne 0 ]; then
            g10s_OSVersion="NFS4U0"
            g10s_kernelType="normal"
        elif [ $(cat /etc/nfs-release | grep "NFS Security Server" | wc -l) -ne 0 ]; then
            g10s_OSVersion="NFSSEC"
            g10s_kernelType="normal"            
        else
            print_error "38" "unknown kernel.[$(cat /etc/nfs-release)]" "g10s"
            return 1
        fi
        return 0
    }

    function g10s_check_inner_data()
    {
        # G10S_INNER_FLAG can be empty
        if [ "${G10S_INNER_OS_NAME}" != "" ] && [ "${G10S_INNER_OS_TYPE}" != "" ] && [ "${G10S_INNER_UNAME_R}" != "" ] && \
            [ "${G10S_INNER_KERNEL_TYPE}" != "" ] && [ "${G10S_INNER_MODULES_DIR}" != "" ] && \
            [ "${G10S_INNER_MODE}" != "" ]; then
            return 0
        fi
        return 1
    }

    function g10s_use_os_cfg()
    {
        local pre_os_config="/opt/UltraPath/cfg/os_cfg"

        g10s_check_inner_data
        if [ $? -eq 0 ]; then
            g10s_OSVersion="${G10S_INNER_OS_NAME}"
            g10s_kernelType="${G10S_INNER_KERNEL_TYPE}"
            G10S_CUR_MODULES_DIR="${G10S_INNER_MODULES_DIR}"
            G10S_CUR_MODE="${G10S_INNER_MODE}"
            G10S_CUR_FLAG="${G10S_INNER_FLAG}"
            return 0
        fi
        if [ ! -f "${pre_os_config}" ]; then
            return 1
        fi
        . "${pre_os_config}"

        G10S_INNER_OS_NAME="${OS_CFG_NAME}"
        G10S_INNER_OS_TYPE="${OS_CFG_TYPE}"
        G10S_INNER_UNAME_R="${OS_CFG_UNAMER}"
        G10S_INNER_KERNEL_TYPE="${OS_CFG_KERNEL_TYPE}"
        G10S_INNER_MODULES_DIR="${OS_CFG_MODULES_DIR}"
        G10S_INNER_MODE="${OS_CFG_MODE}"
        G10S_INNER_FLAG="${OS_CFG_FLAG}"
        g10s_check_inner_data
        if [ $? -ne 0 ]; then
            print_error "38" "invalid config from [${pre_os_config}] in g10s" "$0"
            return 1
        fi
        g10s_OSVersion="${G10S_INNER_OS_NAME}"
        g10s_kernelType="${G10S_INNER_KERNEL_TYPE}"
        G10S_CUR_MODULES_DIR="${G10S_INNER_MODULES_DIR}"
        G10S_CUR_MODE="${G10S_INNER_MODE}"
        G10S_CUR_FLAG="${G10S_INNER_FLAG}"
        return 0
    }

    function g10s_getOSTypeOnline()
    {
        g10s_OSVersion=""
        g10s_kernelType=""
        local thisKernel
        g10s_OSReleaseFile=""
        local ret=0

        g10s_use_os_cfg
        if [ $? -eq 0 ]; then
            return 0
        fi
        thisKernel=$(g10s_curUnamer)

        if [ -f /etc/SuSE-release ] || [ -f /etc/SUSE-brand ]
        then
            if [ -f /etc/SuSE-release ]
            then
                g10s_OSReleaseFile="/etc/SuSE-release"
                __g10s_getOSForSuSE
                ret=$?
            else
                g10s_OSReleaseFile="/etc/os-release"
                g10s_get_os_by_conf "suse15"
                ret=$?
            fi
            if [ $ret -eq 1 ]
            then
                return 1
            fi
        elif [ -f /etc/asianux-release ]
        then
            g10s_OSReleaseFile="/etc/asianux-release"
            __g10s_getOSForAsianux
            if [ $? -ne 0 ]
            then
                return 1
            fi
        elif [ -f /etc/oracle-release ]
        then
             g10s_OSReleaseFile="/etc/oracle-release"
            __g10s_getOSForOracleLinux
            if [ $? -ne 0 ]
            then
                return 1
            fi
        elif [ -f /etc/rocky-release ]
        then
            g10s_OSReleaseFile="/etc/rocky-release"
            __g10s_getOSForRockyLinux
            if [ $? -ne 0 ]
            then
                return 1
            fi
        elif [ -f /etc/neokylin-release ]
        then
             g10s_OSReleaseFile="/etc/neokylin-release"
            __g10s_getOSForNeoKylin
            if [ $? -ne 0 ]
            then
                return 1
            fi
        elif [ -f /etc/isoft-release ]
        then
             g10s_OSReleaseFile="/etc/isoft-release"
            __g10s_getOSForISoft
            if [ $? -ne 0 ]
            then
                return 1
            fi
        elif [ -f /etc/hce-release ]
        then
            g10s_OSReleaseFile="/etc/hce-release"
            __g10s_getOSForHCE
            if [ $? -ne 0 ]
            then
                return 1
            fi
        elif [ -f /etc/euleros-release ]
        then
            g10s_OSReleaseFile="/etc/euleros-release"
            __g10s_getOSForEulerOS
            if [ $? -ne 0 ]
            then
                return 1
            fi
        elif [ -f /etc/nfs-release ] && [ -f /etc/centos-release ]; then
            g10s_OSReleaseFile="/etc/nfs-release"
            getOSForNFS
            if [ $? -ne 0 ]
            then
                return 1
            fi
        elif [ -f /etc/redhat-release ]
        then
            g10s_OSReleaseFile="/etc/redhat-release"
            __g10s_getOSForCentOS
            ret=$?
            if [ $ret -eq 1 ]
            then
                return 1
            fi
        elif [ -f /etc/kylin-release ]
        then
            g10s_OSReleaseFile="/etc/kylin-release"
            __g10s_getOSForKylin
            if [ $? -ne 0 ]
            then
                return 1
            fi
        elif [ -f /etc/linx-release ] && [ ! -f /etc/debian_version ]
        then
            g10s_OSReleaseFile="/etc/linx-release"
            g10s_kernelType="normal"
            __g10s_getOSForROCKY4SP2
            if [ $? -ne 0 ]
            then 
                return 1
            fi
        elif [ -f /etc/deepin_version ] && [ -f /etc/debian_version ]
        then
            g10s_OSReleaseFile="/etc/deepin_version"
            g10s_kernelType=$(g10s_curUnamer | awk -F "-" '{print $NF}')
            g10s_OSVersion="DEEPIN$(cat /etc/deepin-version | grep "Version" | awk -F "=" '{print $2}')"
        elif [ -f /etc/os-release ] && [ -f /etc/deepin-version ] && [ -f /etc/debian_version ]
        then
            g10s_OSReleaseFile="/etc/os-release"
            g10s_kernelType="normal"
            __g10s_getOSForUOS
            if [ $? -ne 0 ]
            then
                return 1
            fi
        elif [ -f "/etc/debian_version" ]
        then
            g10s_OSReleaseFile="/etc/debian_version"
            __g10s_getOSForRocky6
        elif [ -f /etc/openEuler-release ]
        then
            g10s_OSReleaseFile="/etc/openEuler-release"
            __g10s_getOSForOpenEuler
            if [ $? -ne 0 ]
            then
                return 1
            fi
        elif [ -f /etc/ctyunos-release ]
        then
            g10s_OSReleaseFile="/etc/ctyunos-release"
            __g10s_getOSForCTyunOS
            if [ $? -ne 0 ]
            then
                return 1
            fi
        elif [ -f /etc/FusionOS-release ]
        then
            g10s_OSReleaseFile="/etc/FusionOS-release"
            __g10s_getOSForFusion
            if [ $? -ne 0 ]
            then
                return 1
            fi
        fi

        __g10s_getOSForUVP
        if [ $? -ne 0 ]
        then
            return 1
        fi

        g10s_kernelType=$(echo ${g10s_kernelType})
        g10s_OSVersion=$(echo ${g10s_OSVersion})
        if [ "${g10s_OSVersion}" = "" ] || [ "${g10s_kernelType}" = "" ] || [ "${g10s_OSReleaseFile}" = "" ]
        then
            print_error "22" "unknown system.[g10s_OSVersion=${g10s_OSVersion},g10s_kernelType=${g10s_kernelType}],unamer=${thisKernel} in g10s" "$0"
            return 1
        fi

        # new way to get OS name, need not check if it's supported
        if [ $ret -eq 2 ]; then
            return 0;
        fi

        g10s_checkSupportOS "${g10s_OSVersion}"
        if [ $? -ne 0 ]; then
            return 1
        fi
        
        return 0
    }

    function g10s_getOSType()
    {
        g10s_OSVersion=""
        g10s_kernelType=""
        
        g10s_getOSTypeOnline
        if [ $? -ne 0 ]
        then
            if [ "${UnattendInstallUltraPathFlag}" = "1" ]
            then
                return 1
            else
                eval "${g10s_exitFun} 1"
            fi
        fi
        
        if [ "${g10s_kernelType}" = "" ] || [ "${g10s_OSVersion}" = "" ]
        then
            print_error "22" "unsupported system" "g10s"
            eval "${g10s_exitFun} 1"
        fi 

        g10s_saveConf "${g10s_ultraPathPackagesInfo}" "g10s_OSVersion" "${g10s_OSVersion}"
        g10s_saveConf "${g10s_ultraPathPackagesInfo}" "g10s_kernelType" "${g10s_kernelType}"

        return 0
    }
    
    function g10s_checkMultipathdStatus()
    {
        local number

        number=`ps x|grep "multipathd" | grep -v "grep"|wc -l`
        if [ ${number} -lt 1 ]; then
            return 1
        else 
            return 0
        fi

    }

    function g10s_checkDmStatus()
    {
        lsmod | grep -w '^dm_multipath' 2>/dev/null 1>&2
        status=`echo $?`
        if [[ $status == 0 ]]; then
            return 0
        else
            return 1
        fi
    }

    function g10s_CommonTakeoverCheck()
    {
        local sdDev="sd"
        local vendor=""
        local dmStatus
        local fileNoExist="false"
        g10s_checkDmStatus
        dmStatus=$?

        if [ ${dmStatus} -ne 0 ] 
        then
            print_debug "check common takeover: multipath service is not loaded, so multipath -ll command is not exec."
            return 2
        fi
        for tmpLine in `multipath -ll 2>/dev/null | grep "[0-9]:[0-9]:[0-9]:[0-9]" | grep "sd" | awk -F "sd" '{print $2}' | awk '{print$1}' `
        do
            sdDev="${sdDev}${tmpLine}"
            
            if [ -f "/sys/block/${sdDev}/device/vendor" ]
            then
                vendor=`cat /sys/block/${sdDev}/device/vendor`
                vendor=`echo "${vendor}" | sed 's/^[ \t]*//g' | sed 's/[ \t]*$//g'`
                
                if [ "${vendor}" = "up" ]
                then
                    return 3
                fi
     
            else
                fileNoExist="true"
                
            fi
            
            sdDev="sd"
        done
        
        if [ "${fileNoExist}" = "true" ] 
        then
            print_error "4" "one sd device vendor file or directory does not exist."
        fi
        
        return 4
    }
    function g10s_getSysBitOnline()
    {
        g10s_sysbit=`getconf LONG_BIT 2>/dev/null`
        if [ "${g10s_sysbit}" = "" ]
        then
            print_debug "get system bit failed.try excute \"uname -i\" to get." "g10s"
            if [ `uname -i|grep -E "x86_64"|wc -l` -ne 0 ]
            then
                g10s_sysbit="x86_64"
            elif [ `uname -i|grep -E "ia64"|wc -l` -ne 0 ]
            then
                g10s_sysbit="ia64"
            elif [ `uname -i | grep "aarch64" | wc -l` -ne 0 ]
            then
                g10s_sysbit="aarch64"
            elif [ `uname -i | grep "unknown" | wc -l` -ne 0 ]
            then
                print_error "17" "get system bit failed[uname -i]" "g10s"
                return 1
            else
                g10s_sysbit="i386"
            fi
        elif [ "${g10s_sysbit}" = "64" ]
        then
            if [ `uname -i|grep -E "ia64"|wc -l` -ne 0 ]
            then
                g10s_sysbit="ia64"
            elif [ `uname -i | grep "aarch64" | wc -l` -ne 0 ]
            then
                g10s_sysbit="aarch64"
            elif [ `uname -i | grep "unknown" | wc -l` -ne 0 ]
            then
                if [ `uname -m|grep -c "unknown"` -ne 0 ]
                then

                    print_error "17" "uname -i is unknown, set sysbit=${g10s_sysbit}" "g10s"
                    return 1
                elif [ `uname -m|grep -c "ia64"` -ne 0 ]
                then
                    g10s_sysbit="ia64"
                elif [ `uname -m|grep -E "x86_64"|wc -l` -ne 0 ]
                then
                    g10s_sysbit="x86_64"
                elif [ $(uname -m | grep -c "aarch64") -ne 0 ]; then
                    g10s_sysbit="aarch64"
                fi
            else
                g10s_sysbit="x86_64"
            fi

        elif [ "${g10s_sysbit}" = "32" ]
        then
            g10s_sysbit="i386"
        fi
        return 0
    }


    function g10s_getSysBit()
    {
        g10s_getSysBitOnline
        if [ $? -ne 0 ]
        then
            if [ "${UnattendInstallUltraPathFlag}" = "1" ]
            then
                return 1
            else
                eval "${g10s_exitFun} 1"
            fi
        fi
        g10s_saveConf "${g10s_ultraPathPackagesInfo}" "g10s_sysbit" "${g10s_sysbit}"
        return 0
    }


    function g10s_getOSKernelsOnline()
    {
        local tmpKernel=""
        local tmpKernels=""
        print_debug "get system kernels" "g10s"
        g10s_checkExist "-d" "/lib/modules/" 2
        g10s_allKernels="|"
        
        tmpKernels=($(ls /lib/modules/ 2>/dev/null))
        for tmpKernel in "${tmpKernels[@]}"
        do
            g10s_allKernels="${g10s_allKernels}${tmpKernel}|"
        done
        if [ "${g10s_allKernels}" = "|" ]
        then
            print_error "32" "get system kernel information failed." "g10s"
            eval "${g10s_exitFun} 1"
        fi

        return 0
    }


    function g10s_getOtherIsspInstalled()
    {
        if [ -f ${g10s_isspinitrdrecordfile} ]
        then
            g10s_OtherIsspInstalled=`cat "${g10s_isspinitrdrecordfile}" | grep -v "${g10s_isspinitrdrecordname}" | grep "[[:alnum:]]"`
        fi
        print_debug "you have installed ${g10s_OtherIsspInstalled}"
        return 0
    }

    readonly  g10s_installConf="/UltraPath/install/linuxTools/globalLib/g20c_installConf/g20c_install.conf"
    
function g10s_getModulesDirForOracle5_x64()
{
    g10s_getOSType
    local curKernel=`g10s_curUnamer`
    local r1=`echo "${curKernel}" | awk -F "-" '{print $1}'`
    local r2=`echo "${curKernel}" | awk -F "." '{print $3}' | awk -F "-" '{print $2}'`
    local r3=`echo "${curKernel}" | awk -F "." '{print $4}'`
    local uekVersion=${r1}-${r2}
     
    if [ "${g10s_kernelType}" = "normal" ]
    then
        if [ `echo "${curKernel}" |grep -c "el5"` -eq 1 ]
        then
            echo "2.6.18-308.el5"
        fi
    elif [ "${g10s_kernelType}" = "uek" ]
    then
        case $uekVersion in
        "2.6.32-200"*)
            echo "2.6.32-200.13.1.el5uek"
            ;;
        "2.6.32-300"*)
            echo "2.6.32-300.10.1.el5uek"
            ;;
        "2.6.39-300"*)
            echo "2.6.39-300.26.1.el5uek"
            ;;
        "2.6.39-400"*)
            if [ $r3 -eq 209 ]
            then
                echo "2.6.39-400.209.1.el5uek"
            elif [ $r3 -eq 215 ]
            then
                echo "2.6.39-400.215.10.el5uek"
            else
                print_error "32" "get modules dir for oracle failed.[${curKernel}]" "g10s"
                eval "${g10s_exitFun} 1"
            fi
            ;;
        *)
            print_error "32" "get modules dir for oracle failed.[${curKernel}]" "g10s"
            eval "${g10s_exitFun} 1"
            ;;
        esac
            
    elif [ "${g10s_kernelType}" = "xen" ]
    then
        echo "2.6.18-308.el5xen"
    else
        print_error "32" "get modules dir for oracle failed.[${curKernel}]" "g10s"
        eval "${g10s_exitFun} 1"
    fi
}

function g10s_getModulesDirForOracle6_x64()
{
    g10s_getOSType
    local curKernel=`g10s_curUnamer`
    local r1=`echo "${curKernel}" | awk -F "-" '{print $1}'`
    local r2=`echo "${curKernel}" | awk -F "." '{print $3}' | awk -F "-" '{print $2}'`
    local r3=`echo "${curKernel}" | awk -F "." '{print $4}'`
    local uekVersion=${r1}-${r2}
     
    if [ "${g10s_kernelType}" = "normal" ]
    then
        if [ `echo "${curKernel}" |grep -c "el6"` -eq 1 ]
        then
            echo "2.6.32-131.0.15.el6.x86_64"
        fi
    elif [ "${g10s_kernelType}" = "uek" ]
    then
        case $uekVersion in
        "2.6.32-100"*)
            echo "2.6.32-100.34.1.el6uek.x86_64"
            ;;
        "2.6.32-300"*)
            echo "2.6.32-300.3.1.el6uek.x86_64"
            ;;
        "2.6.39-200"*)
            echo "2.6.39-200.24.1.el6uek.x86_64"
            ;;
        "2.6.39-400"*)
            echo "2.6.39-400.17.1.el6uek.x86_64"
            ;;
        "3.8.13-16"*)
            echo "3.8.13-16.2.1.el6uek.x86_64"
            ;;
        "3.8.13-44"*)
            echo "3.8.13-44.1.1.el6uek.x86_64"
            ;;
        "3.8.13-68"*)
            echo "3.8.13-68.3.4.el6uek.x86_64"
            ;;
        "4.1.12-37"*)
            echo "4.1.12-37.4.1.el6uek.x86_64"
            ;;
        "4.1.12-61"*)
            echo "4.1.12-61.1.28.el6uek.x86_64"
            ;;
        "4.1.12-124"*)
            echo "4.1.12-124.16.4.el6uek.x86_64"
            ;;
        *)
            print_error "32" "get modules dir for oracle failed.[${curKernel}]" "g10s"
            eval "${g10s_exitFun} 1"
            ;;
        esac
            
    elif [ "${g10s_kernelType}" = "uekdi" ]
    then
         echo "2.6.39-400.21.1.el6uek.di.x86_64"
    else
        print_error "32" "get modules dir for oracle failed.[${curKernel}]" "g10s"
        eval "${g10s_exitFun} 1"
    fi
}

function g10s_getModulesDirForOracle7_x64()
{
    g10s_getOSType
    local curKernel=`g10s_curUnamer`
    local r1=`echo "${curKernel}" | awk -F "-" '{print $1}'`
    local r2=`echo "${curKernel}" | awk -F "." '{print $3}' | awk -F "-" '{print $2}'`
    local r3=`echo "${curKernel}" | awk -F "." '{print $4}'`
    local uekVersion=${r1}-${r2}
     
    if [ "${g10s_kernelType}" = "normal" ]
    then
        if [ `echo "${curKernel}" |grep -c "el7"` -eq 1 ]
        then
            if [ $r2 -lt 229 ]
            then
                echo "3.10.0-123.el7.x86_64"
            elif [ $r2 -ge 229 ] && [ $r2 -lt 327 ]
            then
                echo "3.10.0-229.el7.x86_64"
            elif [ $r2 -ge 327 ] && [ $r2 -lt 693 ]
            then
                echo "3.10.0-327.el7.x86_64"
            elif [ $r2 -ge 693 ] && [ $r2 -lt 862 ]
            then
                echo "3.10.0-693.el7.x86_64"
            elif [ $r2 -ge 862 ] && [ $r2 -lt 957 ]
            then
                echo "3.10.0-862.el7.x86_64"
            elif [ $r2 -ge 957 ]
            then
                echo "3.10.0-957.el7.x86_64"
            fi
        fi
    elif [ "${g10s_kernelType}" = "uek" ]
    then
        case $uekVersion in
        "3.8.13-35"*)
            echo "3.8.13-35.3.1.el7uek.x86_64"
            ;;
        "3.8.13-55"*)
            echo "3.8.13-55.1.6.el7uek.x86_64"
            ;;
        "3.8.13-98"*)
            echo "3.8.13-98.7.1.el7uek.x86_64"
            ;;
        "3.8.13-118"*)
            echo "3.8.13-98.7.1.el7uek.x86_64"
            ;;
        "4.1.12-61"*)
            echo "4.1.12-61.1.18.el7uek.x86_64"
            ;;
        "4.1.12-94"*)
            echo "4.1.12-94.3.9.el7uek.x86_64"
            ;;
        "4.1.12-112"*)
            echo "4.1.12-112.16.4.el7uek.x86_64"
            ;;
        "4.1.12-124"*)
            echo "4.1.12-112.16.4.el7uek.x86_64"
            ;;
        "4.14.35-1818"*)    
            echo "4.14.35-1818.3.3.el7uek.x86_64"
            ;;
        *)
            print_error "32" "get modules dir for oracle failed.[${curKernel}]" "g10s"
            eval "${g10s_exitFun} 1"
            ;;
        esac

    else
        print_error "32" "get modules dir for oracle failed.[${curKernel}]" "g10s"
        eval "${g10s_exitFun} 1"
    fi
}

function g10s_getModulesDirForOracle5_x86()
{
    g10s_getOSType
    local curKernel=`g10s_curUnamer`
    local r1=`echo "${curKernel}" | awk -F "-" '{print $1}'`
    local r2=`echo "${curKernel}" | awk -F "." '{print $3}' | awk -F "-" '{print $2}'`
    local r3=`echo "${curKernel}" | awk -F "." '{print $4}'`
    local uekVersion=${r1}-${r2}
     
    if [ "${g10s_kernelType}" = "normal" ]
    then
        if [ `echo "${curKernel}" |grep -c "el5"` -eq 1 ]
        then
            echo "2.6.18-308.el5"
        fi
    elif [ "${g10s_kernelType}" = "uek" ]
    then
        case $uekVersion in
        "2.6.32-200"*)
            echo "2.6.32-200.13.1.el5uek"
            ;;
        "2.6.32-300"*)
            echo "2.6.32-300.10.1.el5uek"
            ;;
        "2.6.39-300"*)
            echo "2.6.39-300.26.1.el5uek"
            ;;
        "2.6.39-400"*)
            if [ $r3 -eq 209 ]
            then
                echo "2.6.39-400.209.1.el5uek"
            elif [ $r3 -eq 215 ]
            then
                echo "2.6.39-400.215.10.el5uek"
            else
                print_error "32" "get modules dir for oracle failed.[${curKernel}]" "g10s"
                eval "${g10s_exitFun} 1"
            fi
            ;;
        *)
            print_error "32" "get modules dir for oracle failed.[${curKernel}]" "g10s"
            eval "${g10s_exitFun} 1"
            ;;
        esac
            
    elif [ "${g10s_kernelType}" = "xen" ]
    then
        echo "2.6.18-308.el5xen"
    elif [ "${g10s_kernelType}" = "PAE" ]
    then
        echo "2.6.18-308.el5PAE"
    else
        print_error "32" "get modules dir for oracle failed.[${curKernel}]" "g10s"
        eval "${g10s_exitFun} 1"
    fi
}

function g10s_getModulesDirForOracle6_x86()
{
    g10s_getOSType
    local curKernel=`g10s_curUnamer`
    local r1=`echo "${curKernel}" | awk -F "-" '{print $1}'`
    local r2=`echo "${curKernel}" | awk -F "." '{print $3}' | awk -F "-" '{print $2}'`
    local r3=`echo "${curKernel}" | awk -F "." '{print $4}'`
    local uekVersion=${r1}-${r2}
     
    if [ "${g10s_kernelType}" = "normal" ]
    then
        if [ `echo "${curKernel}" |grep -c "el6"` -eq 1 ]
        then
            echo "2.6.32-131.0.15.el6.i686"
        fi
    elif [ "${g10s_kernelType}" = "uek" ]
    then
        case $uekVersion in
        "2.6.32-100"*)
            echo "2.6.32-100.34.1.el6uek.i686"
            ;;
        "2.6.32-300"*)
            echo "2.6.32-300.3.1.el6uek.i686"
            ;;
        "2.6.39-400"*)
            if [ $r3 -eq 17 ]
            then
                echo "2.6.39-400.17.1.el6uek.i686"
            elif [ $r3 -eq 211 ]
            then
                echo "2.6.39-400.211.1.el6uek.i686"
            elif [ $r3 -eq 215 ]
            then
                echo "2.6.39-400.215.10.el6uek.i686"
            elif [ $r3 -eq 250 ]
            then
                echo "2.6.39-400.250.7.el6uek.i686"
            elif [ $r3 -eq 278 ] 
            then
                echo "2.6.39-400.278.2.el6uek.i686"			
            else
                print_error "32" "get modules dir for oracle failed.[${curKernel}]" "g10s"
                eval "${g10s_exitFun} 1"
            fi
            ;;
        *)
            print_error "32" "get modules dir for oracle failed.[${curKernel}]" "g10s"
            eval "${g10s_exitFun} 1"
            ;;
        esac
            
    else
        print_error "32" "get modules dir for oracle failed.[${curKernel}]" "g10s"
        eval "${g10s_exitFun} 1"
    fi
}

function g10s_getModulesDirForKylin10_aarch64()
{
    local curKernel
    local minVersion
    
    curKernel=$(g10s_curUnamer)
    minVersion=$(echo ${curKernel} | awk -F "-" '{print $2}' | awk -F "." '{print $1}')
    if [ -z "${minVersion}" ]
    then
        echo "4.19.90-17.ky10.aarch64"
        return
    fi
    if [ ${minVersion} -le 17 ]
    then
        echo "4.19.90-17.ky10.aarch64"
    else
        echo "4.19.90-23.8.v2101.ky10.aarch64"
    fi
}

function g10s_getModulesDirForKylin10Sp2_aarch64()
{
    local curKernel
    local minVersion

    curKernel=$(g10s_curUnamer)
    minVersion=$(echo ${curKernel} | awk -F "-" '{print $2}' | awk -F "." '{print $1}')
    if [ -z "${minVersion}" ]
    then
        echo "4.19.90-24.4.v2101.ky10.aarch64"
        return
    fi
    if [ ${minVersion} -ge 24 ]
    then
        echo "4.19.90-24.4.v2101.ky10.aarch64"
    else
        echo ""
    fi
}

function g10s_getModulesDirForKylin10Sp2_x64()
{
    local curKernel
    local minVersion

    curKernel=$(g10s_curUnamer)
    minVersion=$(echo ${curKernel} | awk -F "-" '{print $2}' | awk -F "." '{print $1}')
    if [ -z "${minVersion}" ]
    then
        echo "4.19.90-24.4.v2101.ky10.x86_64"
        return
    fi
    if [ ${minVersion} -ge 24 ]
    then
        echo "4.19.90-24.4.v2101.ky10.x86_64"
    else
        echo ""
    fi
}

function g10s_getModulesDirForKylin10Sp3_x64()
{
    local curKernel
    local minVersion

    curKernel=$(g10s_curUnamer)
    minVersion=$(echo ${curKernel} | awk -F "-" '{print $2}' | awk -F "." '{print $1}')
    if [ -z "${minVersion}" ]
    then
        echo "4.19.90-52.15.v2207.ky10.x86_64"
        return
    fi
    if [ ${minVersion} -ge 52 ]
    then
        echo "4.19.90-52.15.v2207.ky10.x86_64"
    else
        echo ""
    fi
}

function g10s_getModulesDirForKylin10Sp3_aarch64()
{
    local curKernel
    local minVersion

    curKernel=$(g10s_curUnamer)
    minVersion=$(echo ${curKernel} | awk -F "-" '{print $2}' | awk -F "." '{print $1}')
    if [ -z "${minVersion}" ]
    then
        echo "4.19.90-52.15.v2207.ky10.aarch64"
        return
    fi
    if [ ${minVersion} -ge 52 ]
    then
        echo "4.19.90-52.15.v2207.ky10.aarch64"
    else
        echo ""
    fi
}

function g10s_getModulesDirForKylin10_x64()
{
    local curKernel
    local minVersion

    curKernel=$(g10s_curUnamer)
    minVersion=$(echo ${curKernel} | awk -F "-" '{print $2}' | awk -F "." '{print $1}')
    if [ -z "${minVersion}" ]
    then
        echo "4.19.90-17.ky10.x86_64"
        return
    fi
    if [ ${minVersion} -le 17 ]
    then
        echo "4.19.90-17.ky10.x86_64"
    elif [ ${minVersion} -gt 17 ] && [ ${minVersion} -lt 25 ]
    then
        echo "4.19.90-23.8.v2101.ky10.x86_64"
    else
        echo "4.19.90-25.2.v2101.gfb01.ky10.x86_64"
    fi
}

function g10s_getModulesDirForCentOS7_x64()
{
    local lustreKey=""
    g10s_getOSType
    minVersion=`g10s_curUnamer | awk -F "-" '{print $2}' | awk -F "." '{print $1}'`
    if [ -z "${minVersion}" ]
    then
        return
    fi
    
    if [ $(g10s_curUnamer | grep -c "lustre") -ne 0 ]
    then
        lustreKey="_lustre"
    fi

    if [ $minVersion -lt 229 ]
    then
        echo "3.10.0-123.el7.x86_64"
    elif [ $minVersion -ge 229 ] && [ $minVersion -lt 327 ]
    then
        echo "3.10.0-229.el7.x86_64"
    elif [ $minVersion -ge 327 ]  && [ $minVersion -lt 514 ]
    then
        echo "3.10.0-327.el7.x86_64"
    elif [ $minVersion -ge 514 ]  && [ $minVersion -lt 693 ]
    then
        echo "3.10.0-514.el7.x86_64"
    elif [ $minVersion -ge 693 ] && [ $minVersion -lt 862 ]
    then
        echo "3.10.0-693.el7.x86_64"
    elif [ $minVersion -ge 862 ] && [ $minVersion -lt 957 ]
    then
        echo "3.10.0-862.el7.x86_64"
    elif [ $minVersion -ge 957 ] && [ $minVersion -lt 1062 ]
    then
        if [ "${lustreKey}" == "_lustre" ]
        then
            echo "3.10.0-957.1.3.el7_lustre.x86_64"
        else
            echo "3.10.0-957.el7.x86_64"
        fi
    elif [ $minVersion -ge 1062 ] && [ $minVersion -lt 1127 ]
    then
        echo "3.10.0-1062.el7.x86_64"
    elif [ $minVersion -ge 1127 ] && [ $minVersion -lt 1160 ]
    then
        echo "3.10.0-1127.el7.x86_64"
    elif [ $minVersion -ge 1160 ]
    then
        echo "3.10.0-1160.el7${lustreKey}.x86_64"
    fi
}

function g10s_getModulesDirForCentOS7_aarch64()
{
    g10s_getOSType
    minVersion=`g10s_curUnamer | awk -F "-" '{print $2}' | awk -F "." '{print $1}'`
    if [ -z "${minVersion}" ]
    then
        return
    fi
    if [ $minVersion -lt 49 ]
    then
        print_error "32" "unknown kernel.[${g10s_curUnamer}]" "g10s"
        eval "${g10s_exitFun} 1"
    elif [ $minVersion -ge 49 ] && [ $minVersion -lt 115 ]
    then
        echo "4.14.0-49.el7a.aarch64"
    elif [ $minVersion -ge 115 ] && [ $(g10s_curUnamer | awk -F "-" '{print $2}' | awk -F "." '{print $2}') = "el7a" ]
    then
        echo "4.14.0-115.el7a.0.1.aarch64"
    elif [ $minVersion -ge 115 ] && [ $(g10s_curUnamer | awk -F "-" '{print $2}' | awk -F "." '{print $2}') -lt 10 ]
    then
        echo "4.14.0-115.el7a.0.1.aarch64"
    else
        echo "4.14.0-115.10.1.el7a.aarch64"
    fi
}

    g10s_PathForInstall=""
    function g10s_getPathForInstall()
    {
        local ret
        local tmpModulePath

        g10s_getOSType
        if [ "${G10S_CUR_MODULES_DIR}" != "" ]; then
            g10s_PathForInstall="${G10S_CUR_MODULES_DIR}"
            print_debug "get path for install [${g10s_PathForInstall}]."
            return 0
        fi

        g10s_checkExist -f "${g10s_installConf}" 2
        g10s_getSysBit

        ret=$(cat "${g10s_installConf}" | grep -c "^[[:blank:]]*${g10s_OSVersion}_${g10s_kernelType}_${g10s_sysbit}[[:blank:]]*==")
        if [ ${ret} -eq 0 ]
        then
            print_error "1011" "not found any UltraPath Modules for this system.[${g10s_OSVersion}_${g10s_kernelType}_${g10s_sysbit}]" "g10s"
            eval "${g10s_exitFun} 1"
        elif [ ${ret} -gt 1 ]
        then
            print_error "1012" "there's repeat config.[${g10s_OSVersion}_${g10s_kernelType}_${g10s_sysbit}]" "g10s"
            eval "${g10s_exitFun} 1"
        fi

        tmpModulePath=$(cat "${g10s_installConf}"|grep "^[[:blank:]]*${g10s_OSVersion}_${g10s_kernelType}_${g10s_sysbit}[[:blank:]]*=="|awk -F "==" '{print $2}')
        if [ -z "${tmpModulePath}" ]
        then
            print_error "1013" "get module path failed.[${g10s_OSVersion}_${g10s_kernelType}_${g10s_sysbit}]" "g10s"
            eval "${g10s_exitFun} 1"
        fi
        
        if [ "${tmpModulePath}" == "g20c_specialDir" ]
        then
            if [ "${g10s_sysbit}" == "i386" ] && [ $(echo "${g10s_OSVersion}" | grep -E -c "(OL5)") -ne 0 ]
            then
                tmpModulePath=$(g10s_getModulesDirForOracle5_x86)
            elif [ "${g10s_sysbit}" == "i386" ] && [ $(echo "${g10s_OSVersion}" | grep -E -c "(OL6)") -ne 0 ]
            then
                tmpModulePath=$(g10s_getModulesDirForOracle6_x86)
            elif [ "${g10s_sysbit}" == "x86_64" ] && [ $(echo "${g10s_OSVersion}" | grep -E -c "(OL5)") -ne 0 ]
            then
                tmpModulePath=$(g10s_getModulesDirForOracle5_x64)
            elif [ "${g10s_sysbit}" == "x86_64" ] && [ $(echo "${g10s_OSVersion}" | grep -E -c "(OL6)") -ne 0 ]
            then
                tmpModulePath=$(g10s_getModulesDirForOracle6_x64)
            elif [ "${g10s_sysbit}" == "x86_64" ] && [ $(echo "${g10s_OSVersion}" | grep -E -c "(OL7)") -ne 0 ]
            then
                tmpModulePath=$(g10s_getModulesDirForOracle7_x64)
            elif [ "${g10s_sysbit}" == "aarch64" ] && [ $(echo "${g10s_OSVersion}" | grep -E -c "(KYLIN10SP2)") -ne 0 ]
            then
                tmpModulePath=$(g10s_getModulesDirForKylin10Sp2_aarch64)
            elif [ "${g10s_sysbit}" == "x86_64" ] && [ $(echo "${g10s_OSVersion}" | grep -E -c "(KYLIN10SP2)") -ne 0 ]
            then
                tmpModulePath=$(g10s_getModulesDirForKylin10Sp2_x64)
            elif [ "${g10s_sysbit}" == "x86_64" ] && [ $(echo "${g10s_OSVersion}" | grep -E -c "(KYLIN10SP3)") -ne 0 ]
            then
                tmpModulePath=$(g10s_getModulesDirForKylin10Sp3_x64)
            elif [ "${g10s_sysbit}" == "aarch64" ] && [ $(echo "${g10s_OSVersion}" | grep -E -c "(KYLIN10SP3)") -ne 0 ]
            then
                tmpModulePath=$(g10s_getModulesDirForKylin10Sp3_aarch64)
            elif [ "${g10s_sysbit}" == "aarch64" ] && [ $(echo "${g10s_OSVersion}" | grep -E -c "(KYLIN10)") -ne 0 ]
            then
                tmpModulePath=$(g10s_getModulesDirForKylin10_aarch64)
            elif [ "${g10s_sysbit}" == "x86_64" ] && [ $(echo "${g10s_OSVersion}" | grep -E -c "(KYLIN10)") -ne 0 ]
            then
                tmpModulePath=$(g10s_getModulesDirForKylin10_x64)
            elif [ "${g10s_sysbit}" == "x86_64" ] && [ $(echo "${g10s_OSVersion}" | grep -E -c "CentOS7") -ne 0 ]
            then
                tmpModulePath=$(g10s_getModulesDirForCentOS7_x64)
            elif [ "${g10s_sysbit}" == "aarch64" ] && [ $(echo "${g10s_OSVersion}" | grep -E -c "CentOS7") -ne 0 ]
            then
                tmpModulePath=$(g10s_getModulesDirForCentOS7_aarch64)
            fi
            
            if [ -z "${tmpModulePath}" ]
            then
                print_error "1013" "get module path failed.[${g10s_OSVersion}_${g10s_kernelType}_${g10s_sysbit}]" "g10s"
                eval "${g10s_exitFun} 1"
            fi
        fi

        g10s_PathForInstall="${tmpModulePath}"
        print_debug "get path for install [${g10s_PathForInstall}]."
        return 0
    }
    
    function g10s_checkIBCard()
    {
        lspci | grep Mellanox 1>/dev/null 2>&1
        if [ $? -ne 0 ]
        then
            return 1
        fi
        return 0
    }
    
    function g10s_checkIBDriver()
    {
        if [ ! -f /usr/sbin/opensm ] \
        || [ ! -f /usr/sbin/run_srp_daemon ] \
        || [ `find /lib/modules -name ib_srp.ko | wc -l` -eq 0 ] \
        || [ `find /lib/modules -name ib_umad.ko | wc -l` -eq 0 ] \
        || [ `find /lib/modules -name ib_uverbs.ko | wc -l` -eq 0 ]
        then
            return 2
        fi
        return 0
    }

    function g10s_checkIBSupportOS()
    {
        g10s_IB_SupportOSList=("Red Hat Enterprise Linux Server release 6.1 (Santiago)" "Red Hat Enterprise Linux Server release 6.3 (Santiago)" \
        "SUSE Linux Enterprise Server 11 SP3")
        
        g10s_getSysBit
        if [ -f "/etc/issue" ] && [ "${g10s_sysbit}" == "x86_64" ]
        then
            for tmpOs in "${g10s_IB_SupportOSList[@]}"
            do
                if [ `cat /etc/issue | grep -c "${tmpOs}"` -ne 0 ]
                then
                    return 0
                fi
            done
        fi
        return 1
    }
    
    function g10s_checkIBService()
    {
        local ifexist
        local ifopen
        ifexist=`chkconfig --list 2>/dev/null | grep -w "nxup_ibsrp" | wc -l` 
        if [ ${ifexist} -eq 1 ]
        then
            ifopen=`chkconfig --list 2>/dev/null | grep -w "nxup_ibsrp" | grep "3:on" | grep "5:on" | wc -l`
            if [ ${ifopen} -ne 0 ]
            then
                return 2
            else
                return 1
            fi
        else
            return 0
        fi
    }
    
    function g10s_updateIbServ()
    {
        local onoff
        onoff=$1
        print_debug "update ib service" "g10s"
        
        chkconfig nxup_ibsrp off 1>>"${g10s_logFile}" 2>&1
        chkconfig --del nxup_ibsrp 1>>"${g10s_logFile}" 2>&1
        
        g10s_createIBConfigFile
        if [ $? -ne 0 ]
        then
            print_error "1040" "IB config file create failed!"
            return
        else
            chkconfig --add nxup_ibsrp 1>>"${g10s_logFile}" 2>&1
        fi
        
        if [ "${onoff}" == "on" ]
        then
            chkconfig nxup_ibsrp on 1>>"${g10s_logFile}" 2>&1
        fi
    }
    
    function g10s_checkIBSrp()
    {
        g10s_checkIBCard
        if [ $? -ne 0 ]
        then
            return 1
        fi
        
        g10s_checkIBDriver
        if [ $? -ne 0 ]
        then
            return 2
        fi
        
        return 0
    }
    
    function g10s_createIBConfigFile()
    {
        if [ `cat /etc/issue | grep -c "Red Hat"` -ne 0 ]
        then
        
            if [ ! -f /UltraPath/install/linuxTools/toolLib/t301c_ibServices/nxup.redhatIBService ]
            then
                print_error "1014" "Cannot find file nxup.redhatIBService, the IB configuration doesn't complete."
                return 1
            fi
            g10s_cp "/UltraPath/install/linuxTools/toolLib/t301c_ibServices/nxup.redhatIBService" "/etc/init.d/nxup_ibsrp"
            
        elif [ `cat /etc/issue | grep -c "SUSE"` -ne 0 ]
        then
        
            if [ ! -f /UltraPath/install/linuxTools/toolLib/t301c_ibServices/nxup.suseIBService ]
            then
                print_error "1014" "Cannot find file nxup.suseIBService, the IB configuration doesn't complete."
                return 1
            fi
            g10s_cp "/UltraPath/install/linuxTools/toolLib/t301c_ibServices/nxup.suseIBService" "/etc/init.d/nxup_ibsrp"
            
        else
            print_error "1014" "OS Cannot support IB."
            return 1
        fi
       
        if [ ! -f /etc/init.d/nxup_ibsrp ]
        then
            print_error "1015" "Copy file failed, the IB configuration doesn't complete."
            return 1
        fi
        return 0
    }
     
        
    function g10s_getPhyPathIdInfo()
    {
        local g10s_getItemNum=0
        local g10s_checkPhyPathItem="$1"
        local g10s_checkPhyPathStatus="$2"
            
        g10s_PathIds=`upadmin show path 2>/dev/null |grep "^[[:blank:]]*[0-9]"|awk '{printf("%s ",$1)}'`
        g10s_PathIds=(${g10s_PathIds})
        
        if [ ${#g10s_PathIds[@]} -eq 0 ]
        then
            print_debug "not found PhyPath.[g10s_getPhyPathIdInfo]"
            return 0
        fi
        
        print_debug "g10s_PathIds Length=${#g10s_PathIds[*]}."
        print_debug "g10s_PathIds elements=${g10s_PathIds[*]}."
        
        if [ "${g10s_checkPhyPathStatus}" != "" ]
        then
            for PhyPath in "${g10s_PathIds[@]}"
            do
                g10s_tmpPhyPathStat=$(echo $(upadmin show path id=${PhyPath} | grep "^[[:blank:]]*${g10s_checkPhyPathItem}" | awk -F ":" '{print $2}'))
                print_debug "g10_tmpPhyPathStat=${g10s_tmpPhyPathStat}"
                if [ `echo "${g10s_tmpPhyPathStat}" | grep -c "${g10s_checkPhyPathStatus}"` -gt 0 ]
                then
                    let g10s_getItemNum=g10s_getItemNum+1
                fi
            done
            return ${g10s_getItemNum}
        else
            g10s_tmpPhyPathStat=$(echo $(upadmin show path id=${g10s_checkPhyPathItem} | grep "^[[:blank:]]*Path State" | awk -F ":" '{print $2}'))
            echo ${g10s_tmpPhyPathStat}
        fi
    }
    
    function g10s_PhysicPathInfo()
    {
        paranum=$#
        if [ ${paranum} -eq 1 ]
        then
            g10s_getPhyPathIdInfo "$1"
        elif [ ${paranum} -eq 2 ]
        then
            g10s_getPhyPathIdInfo "$1" "$2"
            return $?
        fi
    }
    
    function g10s_checkAndSetValue()
    {
        oldValue=""
        
        if [ -z "$1" ] || [ -z "$2" ]
        then
            print_debug "path {$1} or value {$2} is empty."
            return 1
        fi
        
        oldValue=`cat $1`
        if [ "$2" = "${oldValue}" ]
        then
            return 0
        fi
        
        echo ${2}>${1} 2>/dev/null
        
        return $?
    }

    function g10s_waitSdProbe()
    {
        local wait_sec=5
        local wait_all_sec=300
        local waited=0
        local sdCount
        local sdCountNow
        if [ ! -d /sys/bus/scsi/drivers/sd/ ]
        then
            return 0
        fi

        while [ 1 -eq 1 ]
        do
            if [ ${waited} -ge ${wait_all_sec} ]
            then
                print_debug "wait sdProbe timeout"
                break
            fi
            sdCount=`ls /sys/bus/scsi/drivers/sd/|grep -c -E "[0-9]+:"`
            sleep ${wait_sec}
            let "waited=${waited}+${wait_sec}"
            sdCountNow=`ls /sys/bus/scsi/drivers/sd/|grep -c -E "[0-9]+:"`

            if [ "${sdCount}" -eq "${sdCountNow}" ]
            then
                break
            fi    
        done
    }

    function g10s_checkSelinuxStatus()
    {
        if [ `which sestatus 2>/dev/null | grep -c "/sestatus"` -eq 0 ]
        then
            return 1
        fi
        if [ `sestatus | grep "^[[:blank:]]*SELinux.*status" | grep "enabled" | wc -l` -eq 1 ]
        then 
            return 0
        else
            return 1
        fi
    }
    
    function g10s_os_should_check_nxupservice_selinux_status()
    {
        g10s_getOSType
        g10s_getSysBit
        if [ $(echo "${G10S_CUR_FLAG}" | grep -c -E "(CheckServiceSelinuxStatus)") -eq 1 ]; then
            return 0
        fi
        if [ $(echo "${g10s_OSVersion}"|grep -c -E "(EULEROS2SP8|EULEROS2SP9|EULEROS2SP10|EULEROS2SP11|EULEROS2SP12|OpenEuler20_03|CTyunOS2U0)") -eq 1 ] && [ "${g10s_sysbit}" == "aarch64" ]
        then
            return 0
        elif [ $(echo "${g10s_OSVersion}"|grep -c -E "(^OL7U6$|EULEROS2SP9|EULEROS2SP10|EULEROS2SP11|EULEROS2SP12|NFS4U0|NFSSEC|OpenEuler20_03|FusionOS22|HCE2|CTyunOS2U0|RockyLinux8U5)") -eq 1 ] && [ "${g10s_sysbit}" == "x86_64" ]
        then
            return 0
        fi
        return 1
    }
    
    function exec_cmd()
    {
        if [ -z "${1}" ]
        then
            print_debug "param error."
            return 1
        fi
        
        eval "${1} 1>/dev/null 2>&1"
        if [ $? -ne 0 ]
        then
            print_debug "${1} command failed."
            return 1
        fi
        
        return 0
    }
    
    function g10s_changeSelinuxPermissionForBin()
    {
        local initdObject="texrel_shlib_t"
        
        if [ "${1}" = "" ]
        then
            exec_cmd "chcon -t ${initdObject} /UltraPath/install/otherTools/upadm"
            exec_cmd "chcon -t ${initdObject} /UltraPath/install/otherTools/upadmin"
            exec_cmd "chcon -t ${initdObject} /UltraPath/install/otherTools/slTools"
            exec_cmd "chcon -t ${initdObject} /UltraPath/install/otherTools/ouc"
            exec_cmd "chcon -t ${initdObject} /UltraPath/install/otherTools/cfg_upgrade"
            exec_cmd "chcon -t ${initdObject} /UltraPath/install/otherTools/shell_flock"
            exec_cmd "chcon -t ${initdObject} /UltraPath/install/otherTools/upservice"
            exec_cmd "chcon -t ${initdObject} /usr/sbin/upadm"
            exec_cmd "chcon -t ${initdObject} /usr/sbin/upTools"
            exec_cmd "chcon -t ${initdObject} /usr/sbin/upadmin"
            exec_cmd "chcon -t ${initdObject} /sbin/slTools"
        else
            exec_cmd "chcon -t ${initdObject} ${1}/UltraPath/install/otherTools/upadm"
            exec_cmd "chcon -t ${initdObject} ${1}/UltraPath/install/otherTools/upadmin"
            exec_cmd "chcon -t ${initdObject} ${1}/UltraPath/install/otherTools/slTools"
            exec_cmd "chcon -t ${initdObject} ${1}/UltraPath/install/otherTools/ouc"
            exec_cmd "chcon -t ${initdObject} ${1}/UltraPath/install/otherTools/cfg_upgrade"
            exec_cmd "chcon -t ${initdObject} ${1}/UltraPath/install/otherTools/shell_flock"
            exec_cmd "chcon -t ${initdObject} ${1}/UltraPath/install/otherTools/upservice"
        fi
        
        return 0
    }

    function  g10s_allowSelinuxPermissionForFile()
    {
        g10s_checkExist -f "$1" 2
        if [ "$2" = "" ]
        then
            return 0
        fi
        g10s_checkSelinuxStatus
        if [ $? -eq 1 ]
        then
            return 0
        fi
        if [ $(which semanage 2>/dev/null | grep -c "/semanage") -eq 0 ]
        then
            chcon -Rt "$2" "$1" 1>/dev/null 2>&1
            if [ $? -ne 0 ]
            then
                print_debug "chcon -Rt command failed."
                return 1
            fi
            return 0
        fi
        semanage fcontext -l | grep "$1" 1>/dev/null 2>&1
        if [ $? -eq 0 ]
        then
            print_debug "the selinux permission of \"$1\" has been configured."
            restorecon -FvvR "$1" 1>/dev/null 2>&1
            if [ $? -ne 0 ]
            then
                print_debug "restorecon command failed."
                semanage fcontext -d "$1" 1>/dev/null 2>&1
                return 1
            fi
            return 0
        fi
        semanage fcontext -a -t "$2" "$1" 1>/dev/null 2>&1
        if [ $? -ne 0 ]
        then
            print_debug "semanage fcontext -a -t command failed."
            return 1
        fi
        semanage fcontext -l | grep "$1" 1>/dev/null 2>&1
        if [ $? -ne 0 ]
        then
            print_debug "semanage fcontext -l command failed."
            return 1
        fi
        restorecon -FvvR "$1" 1>/dev/null 2>&1
        if [ $? -ne 0 ]
        then
            print_debug "restorecon command failed."
            semanage fcontext -d "$1" 1>/dev/null 2>&1
            return 1
        fi
        print_debug "the selinux permission of \"$1\" is configured \"$2\" successfully."
        return 0
    }
    
    function g10s_allowSelinuxPermissionForNxup()
    {
        local initdObject=""
        local should_check_selinux=""

        if [ ! -f "/etc/init.d/nxup" ]; then 
            return 0
        fi
        g10s_os_should_check_nxupservice_selinux_status
        should_check_selinux=$?
        if [ ${should_check_selinux} -eq 0 ]
        then
            g10s_checkSelinuxStatus
            if [ $? -eq 0 ]
            then
                if [ $(which semanage 2>/dev/null | grep -c "/semanage") -eq 0 ]
                then
                    print_debug "this system does not have the semanage command. use the chcon instead and the default value:initrc_exec_t."
                    initdObject="initrc_exec_t"
                else
                    initdObject=$(semanage fcontext -l | grep '/etc/init\\\.d/\.\*' | awk -F ":" '{print $3}' 2>&1)
                    if [ -z "${initdObject}" ]
                    then
                        print_debug "not find /etc/init.d/.*, so use default value:initrc_exec_t."
                        initdObject="initrc_exec_t"
                    fi
                fi

                g10s_allowSelinuxPermissionForFile "/etc/init.d/nxup" "${initdObject}"
            fi
        fi
        return 0
    }
    function g10s_restoreSelinuxPermissionForNxup()
    {
        local should_check_selinux=""
        
        if [ ! -f "/etc/init.d/nxup" ]; then 
            return 0
        fi
        g10s_os_should_check_nxupservice_selinux_status
        should_check_selinux=$? 
        if [ ${should_check_selinux} -eq 0 ]
        then
            g10s_checkSelinuxStatus
            if [ $? -eq 0 ]
            then
                if [ `which semanage 2>/dev/null | grep -c "/semanage"` -eq 0 ]
                then
                    return 1
                fi
                semanage fcontext -l | grep '/etc/init.d/nxup' 1>/dev/null 2>&1
                if [ $? -ne 0 ]
                then
                    print_debug "semanage fcontext -l command failed."
                    return 1
                fi
                semanage fcontext -d "/etc/init.d/nxup" 1>/dev/null 2>&1
                if [ $? -ne 0 ]
                then
                    print_debug "semanage fcontext -d command failed."
                fi
                restorecon -FvvR /etc/init.d/nxup 1>/dev/null 2>&1
                if [ $? -ne 0 ]
                then
                    print_debug "restorecon command failed."
                    return 1
                fi
                print_debug "the selinux permission of /etc/init.d/nxup is removed from fcontext successfully."
            fi
        fi
        return 0
    }
    
    function g10s_restoreconFileForSelinux()
    {
        if [ -z "{$1}" ]
        then
            print_error "1" "param error[$1]" "g10s"
            return 1
        fi
        
        restorecon "${1}" 1>/dev/null 2>&1
        if [ $? -ne 0 ]
        then
            print_debug "restorecon command for file[${1}] failed."
            return 1
        fi
        
        return 0
    }

# 切换selinux后多路径文件属性切换
    function g10s_restoreSelinuxPermission()
    {
        g10s_getOSType
        g10s_getSysBit
        if [ $(echo "${g10s_OSVersion}" | grep -c -E "(EULEROS2SP9|EULEROS2SP10|EULEROS2SP11|EULEROS2SP12|KYLIN10SP2|HCE2|RockyLinux8U5|KYLIN10SP3)") -eq 0 ]
        then
            return 0
        fi
        
# EULEROS2SP9_aarch64 不执行后续操作
        if [ $(echo "${g10s_OSVersion}" | grep -c -E "(EULEROS2SP9)") -eq 1 ] && [ "${g10s_sysbit}" == "aarch64" ]
        then
            return 0
        fi
        
        g10s_checkSelinuxStatus
        if [ $? -ne 0 ]
        then
            return 0
        fi
        
        local up_cfg_value=$(cat ${g10s_ultraPathPackagesInfo} | grep "solutionType" | grep "^[[:blank:]]*${1}" | awk -F "=" '{print $2}')
        g10s_restoreconFileForSelinux "/etc/init.d/nxup"
        if [ "${up_cfg_value}" != "mkinitrd" ]
        then
            g10s_restoreconFileForSelinux "/usr/lib/systemd/system/systemd-nxup.service"
            g10s_restoreconFileForSelinux "/etc/systemd/system/sysinit.target.wants/systemd-nxup.service"
            g10s_restoreconFileForSelinux "/usr/sbin/nxupBoot"
        fi

        return 0
    }
    
    function g10s_os_should_check_module_selinux_status()
    {
        g10s_getOSType
        g10s_getSysBit
        if [ $(echo "${G10S_CUR_FLAG}" | grep -c -E "(CheckModuleSelinuxStatus)") -eq 1 ]; then
            return 0
        fi
        if [ $(echo "${g10s_OSVersion}" | grep -c -E "(CentOS7U5|KYLIN7SP5|KYLIN7SP6|EULEROS2SP8|EULEROS2SP9|EULEROS2SP10|EULEROS2SP11|EULEROS2SP12|CentOS7U6|UNIKYLIN3SP3|KYLIN7SP0_7U6|KYLIN10|KYLINSEC3U4|OpenEuler20_03|CTyunOS2U0)") -eq 1 ] && [ "${g10s_sysbit}" == "aarch64" ]
        then
            return 0
        elif [ $(echo "${g10s_OSVersion}"|grep -c -E "(^OL7U6$|EULEROS2SP9|EULEROS2SP10|EULEROS2SP11|EULEROS2SP12|NFS4U0|NFSSEC|KYLIN10_Azalea|KYLINSEC3U4|OpenEuler20_03|FusionOS22|HCE2|CTyunOS2U0|RockyLinux8U5)") -eq 1 ] && [ "${g10s_sysbit}" == "x86_64" ]
        then
            return 0
        fi
        return 1
    }

    function g10s_os_check_semanage_command()
    {
        if [ $(which semanage 2>/dev/null | grep -c "/semanage") -eq 0 ]; then
            print_debug "not find semanage command."
            return 1
        fi
        semanage fcontext -l 1>/dev/null 2>&1
        if [ $? -ne 0 ]; then
            print_debug "run semanage command failed."
            return 1
        fi
        return 0
    }
    
    function g10s_selinuxPermissionForAllow()
    {
        local modObject=""
        local iRet=""
        local kernelVersion=""
        local should_check_selinux=""
        
        g10s_os_should_check_module_selinux_status
        should_check_selinux=$?
        g10s_getConf "${g10s_ultraPathPackagesInfo}" "t140s_solutionType"
        
        if [ ${should_check_selinux} -eq 0 ]
        then
            g10s_checkSelinuxStatus
            iRet="$?"
            if [ "${g10s_confValue}" = "service" ] && [ ${iRet} -eq 0 ]
            then
                kernelVersion=`g10s_curUnamer`
                modObject=`ls -lZ /lib/modules/${kernelVersion}/kernel/drivers/ | grep scsi | awk -F ":" '{print $3}'`
                if [ -z "${modObject}" ]
                then
                    print_debug "not find loading module field, so use default value:modules_object_t."
                    modObject="modules_object_t"
                fi
                g10s_os_check_semanage_command
                if [ $? -ne 0 ]
                then
                    chcon -Rt "${modObject}" "/UltraPath/install/kernelModules" 1>/dev/null 2>&1
                    if [ $? -ne 0 ]
                    then
                        print_debug "chcon -Rt command failed."
                        return 1
                    fi
                    return 0
                fi
                semanage fcontext -l | grep '/UltraPath/install/kernelModules(/.*)?' 1>/dev/null 2>&1
                if [ $? -eq 0 ]
                then
                    print_debug "the selinux permission of modules has been configured."
                    return 0
                fi
                semanage fcontext -a -t "${modObject}" "/UltraPath/install/kernelModules(/.*)?" 1>/dev/null 2>&1
                if [ $? -ne 0 ]
                then
                    print_debug "semanage fcontext -a -t command failed."
                    return 1
                fi
                semanage fcontext -l | grep '/UltraPath/install/kernelModules(/.*)?' 1>/dev/null 2>&1
                if [ $? -ne 0 ]
                then
                    print_debug "semanage fcontext -l command failed."
                    return 1
                fi
                restorecon -FvvR /UltraPath/install/kernelModules/ 1>/dev/null 2>&1
                if [ $? -ne 0 ]
                then
                    print_debug "restorecon command failed."
                    semanage fcontext -d "/UltraPath/install/kernelModules(/.*)?" 1>/dev/null 2>&1
                    return 1
                fi
                print_debug "the selinux permission of modules is configured successfully."
            fi
        fi
        return 0
    }

    function g10s_selinuxPermissionForRestore()
    {
        local should_check_selinux=""
        
        g10s_os_should_check_module_selinux_status
        should_check_selinux=$?
        g10s_getConf "${g10s_ultraPathPackagesInfo}" "t140s_solutionType"
        
        if [ ${should_check_selinux} -eq 0 ]
        then
            if [ `which semanage 2>/dev/null | grep -c "/semanage"` -eq 0 ]
            then
                return 0
            fi
            semanage fcontext -l | grep '/UltraPath/install/kernelModules(/.*)?' 1>/dev/null 2>&1
            if [ $? -ne 0 ]
            then
                print_debug "semanage fcontext -l command failed."
                return
            fi
            semanage fcontext -d "/UltraPath/install/kernelModules(/.*)?" 1>/dev/null 2>&1
            if [ $? -ne 0 ]
            then
                print_debug "semanage fcontext -d command failed."
            fi
            restorecon -FvvR /UltraPath/install/kernelModules/ 1>/dev/null 2>&1
            if [ $? -ne 0 ]
            then
                print_debug "restorecon command failed."
            fi
            print_debug "the selinux permission of modules is removed from fcontext successfully."
        fi
    }

    function g10s_chmodUltraPathFile()
    {
        if [ ! -d /opt/UltraPath ]
        then
            mkdir -p /opt/UltraPath > /dev/null 2>&1
        fi
        chmod 650 /opt/UltraPath > /dev/null 2>&1
        if [ ! -f /opt/UltraPath/upadmin.lock ]
        then
            touch /opt/UltraPath/upadmin.lock > /dev/null 2>&1
        fi
        chmod 660 /opt/UltraPath/upadmin.lock > /dev/null 2>&1
    }

    function g10s_ctmmdeleteFile()
    {
        g10s_getOSType
        if [ $(echo "${g10s_OSVersion}"|grep -c -E "KYLIN7SP0") -eq 0 ]
        then
            return 1
        fi
        g10s_checkExist -f $1 2
        which ctmm_delete >/dev/null 2>&1
        if [ $? -ne 0 ]
        then
            print_debug "ctmm_delete command not found."
            return 1
        fi
        ctmm_delete -f $1 >/dev/null 2>&1
        if [ $? -ne 0 ]
        then
            which ctmm_lookup >/dev/null 2>&1
            if [ $? -eq 0 ]
            then
                if [ $(ctmm_lookup |grep -c "$1") -eq 0 ]
                then
                    return 1
                fi
            fi
            print_debug "ctmm_delete command execute failed."
            eval "${g10s_exitFun} 1"
        fi
        which ctmm_lookup >/dev/null 2>&1
        if [ $? -eq 0 ]
        then
            if [ $(ctmm_lookup |grep -c "$1") -ne 0 ]
            then
                print_debug "file $1 still in ctmm white list, and may cause installation to fail"
                eval "${g10s_exitFun} 1"
            fi
        fi
        print_debug "ctmm_delete -f $1 command execute success."
        return 0
    }
    function g10s_ctmmaddFile()
    {

        g10s_getOSType
        if [ $(echo "${g10s_OSVersion}"|grep -c -E "KYLIN7SP0") -eq 0 ] || [ $2 -ne 0 ]
        then
            return 0
        fi
        g10s_checkExist -f $1 2
        which ctmm_add >/dev/null 2>&1
        if [ $? -ne 0 ]
        then
            print_warning "39" "UltraPath fails to restore the file property." "g10s"
            return 0
        fi
        ctmm_add -f $1 >/dev/null 2>&1
        if [ $? -ne 0 ]
        then
            print_warning "39" "UltraPath fails to restore the file property." "g10s"
            return 0
        fi
        if [ $(ctmm_lookup |grep -c "$1") -eq 0 ]
        then
            print_warning "39" "UltraPath fails to restore the file property." "g10s"
            return 0
        fi
        print_debug "ctmm_add -f $1 command execute success."
        return 0
    }
    function g10s_ctmm_deleteUltraPathFiles()
    {
        local file=("/usr/sbin/updd" "/usr/sbin/upRescan" "/usr/sbin/upLinux" "/usr/sbin/nxupBoot" "/usr/sbin/stop_up_restart_warn" \
                        "/etc/init.d/nxup" "/usr/sbin/upadmin" "/usr/sbin/upTools" "/usr/sbin/upadm" )
        g10s_getOSType
        if [ $(echo "${g10s_OSVersion}"|grep -c -E "KYLIN7SP0") -eq 0 ]
        then
            return 0
        fi

        print_debug "ctmm_delete UltraPath files"
        for i in "${file[@]}"
        do
            ctmm_delete -f ${i} >/dev/null 2>&1
        done
        ultrapathFiles=$(rpm -ql UltraPath)
        for f in ${ultrapathFiles}
        do
            ctmm_delete -f ${f} >/dev/null 2>&1
        done
        return 0
    }
    
    function g10s_killServiceByName()
    {
        local number
        local time
        local temp
        local upsrvpid
        
        if [ -z "${1}" ]
        then
            print_debug "param invalid!"
            i10s_exit 1
        fi
        
        number=$(ps x | grep -v "grep" | grep -cw "${1}")
        if [ ${number} -lt 1 ]
        then
            print_debug "${1} num=${number}"
            return 0
        fi
        killall "${1}" 2>/dev/null
        number=$(ps x | grep -v "grep" | grep -cw "${1}")
        if [ ${number} -lt 1 ]
        then
            print_debug "${1} num=${number}"
            return 0
        fi
        upsrvpid=$(ps x | grep -v "grep" | grep "${1}" | awk '{print $1}')
        kill -9 ${upsrvpid} 2>/dev/null
        number=$(ps x | grep -v "grep" | grep -cw "${1}")
        if [ ${number} -lt 1 ]
        then
            print_debug "${1} num=${number}"
            return 0
        fi
        kill -9 ${upsrvpid} 2>/dev/null
        for (( time=0; time<11; time=time+1))
        do
            number=$(ps x | grep -v "grep" | grep -cw "${1}")
            if [ ${number} -eq 0 ]
            then
                print_debug "${1} kill succeeded, retry times=${time}, retry interval=500ms..."
                break
            else
                sleep 0.5
            fi
        done
        if [ ${time} -ge 11 ]
        then
            print_event "1005" "kill ${1} failed."
            i10s_exit 1
        fi
        print_debug "i10s_killServiceByName execution ends, ${1} num=${temp}"
        return 0
    }

    function g10s_allowSelinuxPermissionForSysConf()
    {
        local confObject
        g10s_getOSType
        if [ $(echo "${G10S_CUR_FLAG}" | grep -c -E "(AllowSelinuxPermission)") -ne 0 ] || \
            [ $(echo "${g10s_OSVersion}" | grep -c -E "(OpenEuler20_03|EULEROS2SP10|EULEROS2SP11|EULEROS2SP12|FusionOS22|CTyunOS2U0|RockyLinux8U5)") -ne 0 ]
        then
            g10s_allowSelinuxPermissionForFile "$1" "$2"
        fi
        return 0
    }
else
    print_debug "g10s_pub is in this shell." "g10s"
fi
