@if not exist echo.on ECHO OFF
IF .%1. == .. GOTO USAGE
IF .%2. == .. GOTO USAGE
set src=%1
set trg=%2
set log=%trg%\os2\install\display.log
set ver=4.00,3.01,3.00,2.11,2.10
%src%\prep_log %log%
IF ERRORLEVEL 3 GOTO LOG_PROBLEM
IF EXIST %src%\BUILD.LVL type %src%\BUILD.LVL >> %log%
IF NOT EXIST %trg%\OS2\INSTALL set missing=%trg%\os2\install&& GOTO MISSING
IF NOT EXIST %src%\INSCFG32.DL_ set missing=%src%\inscfg32.dl_&& GOTO MISSING
IF NOT EXIST %src%\testver.exe set missing=%src%\testver.exe&& goto missing
IF NOT EXIST %src%\chips*.dsc set missing=%src%\chips*.dsc GOTO MISSING
IF EXIST %trg%\os2\install\CT*.DSC del %trg%\os2\install\CT*.DSC >NUL
%src%\testver >> %log%
IF ERRORLEVEL 402 GOTO VER_NOT_OK
IF ERRORLEVEL 400 set dsc=%src%\prereqs.dsc&& GOTO VER_MERLIN
IF ERRORLEVEL 302 GOTO VER_NOT_OK
IF ERRORLEVEL 300 set dsc=%src%\prereqs.dsc&& GOTO VER_WARP
IF ERRORLEVEL 212 GOTO VER_NOT_OK
IF ERRORLEVEL 211 set dsc=%src%\prereqs.dsc&& set cfg=%src%\vcfginst.exe&& GOTO VER_WARP
IF ERRORLEVEL 210 set dsc=%src%\prereqs.dsc&& set cfg=%src%\vcfginst.exe&& GOTO VER_WARP
GOTO VER_NOT_OK
:VER_MERLIN
ECHO Installing Video Drivers for OS/2 v4.0
copy %src%\chipm*.dsc %trg%\os2\install\chips*.dsc >NUL
GOTO VER_OK
:VER_WARP
ECHO Installing Video Drivers for OS/2 v3.0
copy %src%\chips*.dsc %trg%\os2\install >NUL
:VER_OK
if not exist %dsc% set missing=%dsc%&& GOTO MISSING
set apath=%path%
set  path=%src%;%path%
set fil=%src%\dspinstl.ex_
unpack %fil% %trg% >> %log%
IF ERRORLEVEL 1 GOTO UNPACK_ERR
set fil=%src%\inscfg32.dl_
unpack %fil% %trg% >> %log%
IF ERRORLEVEL 1 GOTO UNPACK_ERR
if .%3. == .. set cid=&& goto skipcid
set cid=/u
:skipcid
%trg%\os2\install\dspinstl.exe /pk:other /sk:none /s:%src% /t:%trg%\ /pd:%dsc% /l:%log% %cid%
if .%cfg%. == .. goto skipcfg
if exist %cfg% %cfg%
:skipcfg
%src%\product.exe %src% %trg% %cid%
set  path=%apath%
GOTO END
:VER_NOT_OK
@ECHO.
@ECHO This fixpack is intended for OS/2 versions %ver% only !
@ECHO This fixpack is intended for OS/2 versions %ver% only ! >> %log%
@ECHO.
goto end
:LOG_PROBLEM
@ECHO.
@ECHO Error setting attributes on %log%
@ECHO.
goto end
:UNPACK_ERR
@ECHO.
@ECHO Error unpacking %fil%
@ECHO Error unpacking %fil% >> %log%
@ECHO.
goto end
:MISSING
@ECHO.
@ECHO Cannot locate %missing%
@ECHO Cannot locate %missing% >> %log%
@ECHO.
rem fall thru intended
:USAGE
ECHO.
ECHO Usage: %0 [SOURCE_PATH:] [BOOTDRIVE:] {[CID]}
ECHO.
ECHO Use the optional CID parameter for CID installs
:LOGUSAGE
IF .%trg%. == .. GOTO END
ECHO. >> %log%
ECHO Usage: %0 [SOURCE_PATH:] [BOOTDRIVE:] {[CID]} >> %log%
ECHO. >> %log%
ECHO Use the optional CID parameter for CID installs >> %log%
:END
