@echo off
REM =========================================================
REM ==           Setup environment variables               ==
REM =========================================================

REM --Platform info.

set plat1=TIGH2U
set plat2=NSC2U
set plat_sup_ver=00.22
set plat_sup_date=01/14/2010

REM ------------BMC

set bmc_ver=00.66
set bmc_file=ALBMC66.HEX

REM --FRUSDR

set frusdr_ver=FTA_12

REM --BIOS
set bios_ver=R0096.10
set bios_file=R0096_10.CAP

REM =========================================================
REM ==         End Setup environment variables             ==
REM =========================================================



REM =========================================================
REM                                  Main Choice for BMC
cls 
REM  ---------1---------2---------3---------4---------5---------6---------7---------8
cls
echo ]  %plat1% and %plat2%  System Update Package Version %plat_sup_ver%     %plat_sup_date%
echo ]  ---------------------------------------------------------------------------
echo ]  
echo ]  A system Reboot is required after the selected option is complete:
echo ]
echo ]  Choose an option.
echo ]    1) Full update of the BMC, FRUSDR and BIOS
echo ]	   Order of install:
echo ]		BMC to version %bmc_ver%
echo ]		FRU/SDR to version %frusdr_ver%             
echo ]		BIOS to version %bios_ver%  
echo ]    2) Update just BMC to version %bmc_ver%
echo ]    3) Update just FRU/SDR to version %frusdr_ver%             
echo ]    4) Update just BIOS to version %bios_ver%           	
echo ]    5) Exit to DOS
echo ]  ---------------------------------------------------------------------------
echo ]
choice.com /c:12345 Choose an option:
if errorlevel 5 goto end
if errorlevel 4 goto bios1
if errorlevel 3 goto fru1
if errorlevel 2 goto bmc1
if errorlevel 1 goto bmc
goto end
REM =========================================================

:bmc
REM =========================================================
REM 					     Updating BMC
cls 
echo ]
echo ]  A full update will take about 10 minutes to complete.
echo ]
echo ]  BMC Firmware will be updated to Version %bmc_ver%
echo ]
echo. 
pause 
echo.
echo ]  Update BMC flash using FWPIAUPD utility
echo ]
fwpiaupd -u -b -o -pia -ni -p %bmc_file%
echo.
if errorlevel 1 goto BadExit
echo BMC %bmc_ver% firmware update has completed.
echo.
echo Press a key to begin the FRU/SDR update
pause
goto fru

REM =========================================================

:BMC1
REM =========================================================
REM     					Updating just BMC 
cls    
echo ]
echo ]  BMC Firmware will be updated to Version %bmc_ver%
echo ]
echo.
pause
echo.
echo ]  Update BMC flash using FWPIAUPD utility
echo ]
fwpiaupd -u -b -o -pia -ni -p %bmc_file%
if errorlevel 1 goto BadExit
echo BMC %bmc_ver% firmware update has completed.
echo.
goto end
REM =========================================================

:fru
REM =========================================================
REM
cls					 	Updating FRU
echo ]
echo ]  FRU/SDR update to Version %frusdr_ver%
echo ]
frusdr /cfg
if errorlevel 1 goto BadExit

echo.
echo FRUSDR update has completed successfully
echo Press a key to begin BIOS update
echo.
pause
goto bios
REM =========================================================

:fru1
REM =========================================================
REM                         		   Updating just FRU
cls
echo ]
echo ]  FRU/SDR update to Version %frusdr_ver%
echo ]
echo Press a key to begin the FRU/SDR update
pause
frusdr /cfg
if errorlevel 1 goto BadExit

echo.
echo FRUSDR update has completed successfully
echo.
goto end
REM =========================================================

:bios
REM =========================================================
REM  						Updating BIOS
cls
echo ]
echo ]  Update to BIOS Version %bios_ver%
echo ]
echo.
echo WARNING!!!  WARNING!!!  WARNING!!!
echo Please MAKE SURE the BIOS Bank Select jumper (pin 2-3) is set correctly!
echo .
pause
call Iflash32 %bios_file% /u /ni
if errorlevel 1 goto BadExit
goto end
REM =========================================================

:bios1
REM =========================================================
REM                                        Updating Just BIOS
cls
echo ]
echo ]  Update to BIOS Version %bios_ver%
echo ]
echo.
echo WARNING!!!  WARNING!!!  WARNING!!!
echo Please MAKE SURE the BIOS Bank Select jumper (pin 2-3) is set correctly!
echo .
pause
call Iflash32 %bios_file% /u /ni
if errorlevel 1 goto BadExit
goto end
REM =========================================================


:QUIT

Goto end

:BadExit
echo.
echo An error has occurred.
echo.
echo Ensure the release notes have been followed and try again.
echo.
goto done

:end
echo.
echo Remove Update Media and cycle power on your system now.
echo.

:done