#!/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'`

G7666_X6_BiosConfigImport(){
if [[ "${os_version}" = "7" ]] && [[ "${BIOS_Ver}" = "1.23.01" ]];then
    if [[ -d "/sys/firmware/efi" ]];then
        ./SCELNX_64_5.05.01.0002_2021 /i /s G7666_X6_efi_250807.cfg 
    else
        exit 1
    fi
fi
}
RW4250_I44(){
if [[ "${os_version}" = "7" ]] && [[ "${BIOS_Ver}" = "1.22.01" ]];then
    if [[ -d "/sys/firmware/efi" ]];then
        ./SCELNX_64_5.05.01.0002_2021 /i /s RW4250_I44_EFI_20250829.cfg
    else
        exit 1
    fi
fi
}


if [[ "$Pro_name" == "G7666 X6" ]] ;then
    G7666_X6_BiosConfigImport
elif [[ "$Pro_name" == "RW4250 I44" ]] ;then
    RW4250_I44
else
    echo "this machine don't have BiosConfig file"
    exit 1	
fi
