#!/bin/bash
source /OSM/script/os_load_base.sh

function clearfaultled()
{
#查版本类型，查启动路劲
#echo "DANGER: You are about to perform a danger command. After executing this command,controller will close the controller fault led."
#echo "Are you sure to close this controller fault led?(y/n)"
#判断型号
BOARD_TYPE="`grep "^Product Name is" /proc/osp/bsp | awk '{print $4}'`" 
if [[ "$BOARD_TYPE" != PANGEA_V2R1C01 ]]; then
    OS_echo "[clear fault led failed] ------Board type ($BOARD_TYPE) mismatch."
else
    OS_echo "[Success] ------Board type ($BOARD_TYPE) match."
    #read -p "" L_INPUT
    #if [ "${L_INPUT}" == "y" -o "${L_INPUT}" == "Y" ];then
    result=(`sudo ipmitool raw 0x32 0x71 0x0 0x2 0x0 0x0 0x92 0x5f 0x0 0x0 0x0 0x1 0 0 0 0 0 0 0`)
    if [ $? == 0 ]; then 
      OS_echo "Status: Success."
    else
      OS_echo "[clear fault led failed] Status: Fail.Please Retry."
      exit 1
    fi 
fi
}

clearfaultled
