#!/bin/bash
CPWD=`cd $(dirname  $0);pwd`
os_version=`uname -r |awk -F"el" '{print $2}' |awk -F"." '{print $1}'`
BIOS_Ver=`dmidecode -t 0 |awk '/Version/{print $NF}' |sed 's/\s*//g'`
Pro_name=`ipmitool fru print 0 |awk -F":" '/Product Name/{print $NF}' |sed 's/^\s*//g'`

_6210_C2_BiosConfigImport(){
if [[ "${os_version}" = "7" ]] && [[ "${BIOS_Ver}" = "CNH12A1284" ]];then
    if [[ -d "/sys/firmware/efi" ]];then
        ./SCELNX_64_V5.05.08.0009 /i /s 6210_C2_efi_250815.cfg 
    else
        exit 1
    fi
fi
}

_6215_C2_BiosConfigImport(){
if [[ "${os_version}" = "7" ]] && [[ "${BIOS_Ver}" = "CNH12A1284" ]];then
    if [[ -d "/sys/firmware/efi" ]];then
        ./SCELNX_64_V5.05.08.0009 /i /s 6215_C2_efi_250908.cfg
    else
        exit 1
    fi
fi
}

if [[ "$Pro_name" == "6210 C2" ]] ;then
    _6210_C2_BiosConfigImport
elif [[ "$Pro_name" == "6215 C2" ]] ;then
    _6215_C2_BiosConfigImport
else
    echo "this machine don't have BiosConfig file"
    exit 1	
fi
