#!/bin/bash


_install() {

    SYSCTL_CONFIG="$BASEDIR/configs/sysctl"

    if [[ $Usage = uhost ]] || [[ $Usage = uhadoop ]] || [[ $Usage = uops && $SecUsage = vmzone ]] || [[ $Usage = udb && $SecUsage = sqlserver ]];then
        \cp -f $SYSCTL_CONFIG/sysctl.conf.uhost /etc/sysctl.conf
    elif [[ $Usage = udb || $SecUsage != 'sqlserver' ]]; then
        \cp -f $SYSCTL_CONFIG/sysctl.conf.udb /etc/sysctl.conf
    elif [[ $Usage = udw ]]; then
        \cp -f $SYSCTL_CONFIG/sysctl.conf.udb /etc/sysctl.conf
    elif [[ $Usage = umem ]]; then
        \cp -f $SYSCTL_CONFIG/sysctl.conf.umem /etc/sysctl.conf
    elif [[ $Usage = unet && $SecUsage = ulb ]]; then
        \cp -f $SYSCTL_CONFIG/sysctl.conf.unet.ulb /etc/sysctl.conf
    else
        \cp -f $SYSCTL_CONFIG/sysctl.conf.default /etc/sysctl.conf
    fi

    if [[ $ARCH == 'x86_64' ]];then
        cat >> /etc/sysctl.conf << EOF
# 关闭不可知非屏蔽中断导致内核panic
kernel.unknown_nmi_panic = 0
EOF
    fi

    sysctl -p 2>&1 > /dev/null
}

_check() {
    _check="PASS"
    return 0
}
