@echo off
REM #    prepareResources.cmd
REM # unpack resource images for use by flash scripts
REM #
set chassis=%1
call varset platform "queryProperty IntelBIOSID BoardFamilyID -"

if Exist "%BootDevice%\updates\%platform%" (
   pushd "%BootDevice%\updates\%platform%"
   cd
) else (
   addLogRecord %0 ERROR " Platform %platform% is not recognized."
   goto :finished
)
set updateDir=%DeployPath%\update
If EXIST "%updateDir%" rmdir /s /q "%updateDir%"
mkdir "%updateDir%"

if "%platform%" == "S3000" (
    7z e -y S3000AH_BIOS_Release_0046.zip -o%updateDir%
    goto done
)

if "%chassis%" == "" (
    call queryProperty FRU  "Chassis OEM Field"  - | varSet chassis > nul
    call exportVarSet chassis
)

if "%chassis%" == "" (
   echo usage:    %0 [chassis]
   echo              where [chassis] is one of:
   echo              NSN2U, NSC2U, TIGH2U, TIGW1U, NSW1U, or SR2500LX
   goto done
)

echo %chassis%
echo Unzipping BIOS, FW, FRUSDR resources for %chassis%
goto do%chassis%
echo %ERRORLEVEL%
if %ERRORLEVEL% GEQ 0 (
    echo ERROR chassis %chassis%  is not recognized.
    GOTO done
)

:doSR2500LX
7z e -y AL_06_25_2007.zip -o%updateDir%
goto done

:doTIGH2U
7z e -y STA16_916412.zip -o%updateDir%
goto done

:doNSC2U
7z e -y STA16_916412.zip -o%updateDir%
goto done

:doNSN2U
7z e -y R0016.zip -o%updateDir%
7z e -y BMC_0019.zip -o%updateDir%
7z e -y FUR2_05.zip -o%updateDir%
goto done

:doNSW1U
7z e -y SHB26_912018.zip -o%updateDir%
goto done

:doTIGW1U
7z e -y SHB26_912018.zip -o%updateDir%
:done
popd
:finished

