PWD=`cd $(dirname  $0);pwd`
BIOS_Ver=`dmidecode -t 0 |awk '/Version/{print $NF}' |sed 's/\s*//g'`
Pro_name=`ipmitool fru |awk -F":" '/Product Name/{print $NF}' |sed 's/^\s*//g'`
Pro_name_R=$(ipmitool fru list 0 | awk -F":" '/Product Name/{print $NF}' | xargs)

R5215_A12(){
if [[ "${BIOS_Ver}" = "2.1b" ]];then
        ./sum -c ChangeBiosCfg --file R5215_A12_20230824.cfg --skip_unknown --skip_bbs
        echo $?
fi
}

R8428_G13_BiosConfigImport(){
if [[ "${BIOS_Ver}" = "EG6.22.06" ]];then
	./SCELNX_64 /i /d /s R8428_G13_250604_EFI.cfg
	echo $?
fi
}


if [[ "${Pro_name}" == "R5215 A12" ]];then
        R5215_A12
elif [[ "${Pro_name_R}" == "R8428 G13" ]];then
	R8428_G13_BiosConfigImpor
elif [[ "${Pro_name_R}" == "R8629 G13" ]];then
	./SCELNX_64 /i /d /s R8629_G13_251029_EFI.cfg
else
    echo "Unsupported product: ${Pro_name_R}"
    exit 1
fi

