@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.0,2.11,2.1
%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
%src%\testver >> %log%
IF ERRORLEVEL 400 set dsc=%src%\v3.dsc&& GOTO VER_OK
IF ERRORLEVEL 302 set dsc=%src%\v3.dsc&& GOTO VER_OK
IF ERRORLEVEL 300 set dsc=%src%\v3.dsc&& GOTO VER_OK
IF ERRORLEVEL 212 GOTO VER_NOT_OK
IF ERRORLEVEL 211 set dsc=%src%\pre_v3.dsc&& set cfg=%src%\vcfginst.exe&& GOTO VER_OK
IF ERRORLEVEL 210 set dsc=%src%\pre_v3.dsc&& set cfg=%src%\vcfginst.exe&& GOTO VER_OK
GOTO VER_NOT_OK
:VER_OK
if not exist %dsc% set missing=%dsc%&& GOTO MISSING
set apath=%path%
set  path=%src%;%path%
IF EXIST %src%\wdc24.dsp if not exist %trg%\ibmvesa MD %trg%\ibmvesa
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
