@ECHO OFF
ECHO ÿ
ECHO ************************************************************
ECHO *  OS/2 2.1 Display Driver Installation for miro  (V2.0)   *
ECHO ************************************************************
IF EXIST %2\os2\wininst GOTO NEXTX
   md %2\os2\wininst
:NEXTX
IF .%1. == .. GOTO USAGE
IF .%2. == .. GOTO USAGE
IF NOT EXIST %2\OS2\INSTALL GOTO USAGE
IF NOT EXIST %1\TOOLS GOTO DAMAGED
IF NOT EXIST %1\BUNDLE GOTO DAMAGED
%2\OS2\UNPACK.EXE  %1\TESTVER  %2 >NUL
%2\OS2\INSTALL\TESTVER.EXE %2
IF ERRORLEVEL 1 GOTO END
DEL %2\OS2\INSTALL\TESTVER.EXE 1>NUL 2>NUL
IF NOT .%3. == .. GOTO SKIP
:SKIP
ECHO.
ECHO ************************************************************
ECHO *  Loading files, Please wait.....                         *
ECHO ************************************************************
ECHO.
ECHO miro Installation log file for 16M >> %2\OS2\INSTALL\DISPLAY.LOG
%2\OS2\ATTRIB -R %2\OS2\*.* /S          1>NUL 2>NUL
:START
IF EXIST %2\OS2\SVGA.SAV GOTO NEXT1
COPY %2\OS2\SVGA.EXE %2\OS2\SVGA.SAV >NUL
:NEXT1
IF EXIST %2\OS2\SCREEN0?.SAV GOTO NEXT2
COPY %2\OS2\SCREEN0?.SYS %2\OS2\SCREEN0?.SAV >NUL
:NEXT2
IF EXIST %2\OS2\INSTALL\WINSUP.IAM GOTO NEXT4A
IF EXIST %2\OS2\INSTALL\DSPINSTL.SAV GOTO NEXT3
COPY %2\OS2\INSTALL\DSPINSTL.EXE %2\OS2\INSTALL\DSPINSTL.SAV >NUL
:NEXT3
IF EXIST %2\OS2\INSTALL\RSPDSPI.SAV GOTO NEXT4
COPY %2\OS2\INSTALL\RSPDSPI.EXE %2\OS2\INSTALL\RSPDSPI.SAV >NUL
:NEXT4
%2\OS2\UNPACK %1\TOOLS %2    >NUL
GOTO NEXT4B
:NEXT4A
%2\OS2\UNPACK %1\TOOLS %2 /n:MKSYSLVL.EXE    >NUL
%2\OS2\UNPACK %1\TOOLS %2 /n:S3PATCH.EXE     >NUL
%2\OS2\UNPACK %1\TOOLS %2 /n:OS2KRNL.RTP     >NUL
%2\OS2\UNPACK %1\TOOLS %2 /n:VWIN.RTP        >NUL
:NEXT4B
%2\OS2\UNPACK %1\BUNDLE %2   >NUL
%2\OS2\INSTALL\DDICO.EXE %2
DEL %2\OS2\INSTAL\DDICO.EXE 1>NUL 2>NUL
DEL %2\OS2\INSTALL\PSS3CID.DSC 1>NUL 2>NUL
IF .%3. == .. GOTO UPDATE
%2\OS2\UNPACK %1\CID  %2 >NUL
DEL %2\OS2\INSTALL\PSS3.DSC 1>NUL 2>NUL
:UPDATE
%2\OS2\INSTALL\MKSYSLVL %2\OS2\INSTALL\SYSLEVEL.OS2 XR02110 >NUL
ECHO Updated syslevel.os2 with XR02110 >> %2\OS2\INSTALL\DISPLAY.LOG
DEL %2\OS2\INSTALL\MKSYSLVL.EXE >NUL
%2\OS2\ATTRIB -R -S -H %2\OS2KRNL       1>NUL 2>NUL
ECHO Patching OS2KRNL >> %2\OS2\INSTALL\DISPLAY.LOG
%2\OS2\INSTALL\S3PATCH /NOP /NOS /Q  %2\  %2\OS2\INSTALL\OS2KRNL.RTP >> %2\OS2\INSTALL\DISPLAY.LOG 2>NUL
%2\OS2\ATTRIB +R +S +H %2\OS2KRNL       1>NUL 2>NUL
DEL %2\OS2\INSTALL\OS2KRNL.RTP  >NUL
ECHO Patching VWIN.SYS >> %2\OS2\INSTALL\DISPLAY.LOG
%2\OS2\INSTALL\S3PATCH /NOP /NOS /Q  %2\OS2\MDOS  %2\OS2\INSTALL\VWIN.RTP >> %2\OS2\INSTALL\DISPLAY.LOG 2>NUL
DEL %2\OS2\INSTALL\S3PATCH.EXE  >NUL
DEL %2\OS2\INSTALL\VWIN.RTP     >NUL
IF EXIST %2\OS2\SCREEN01.SAV DEL %\OS2\SCREEN02.SYS 2>NUL
IF EXIST %2\OS2\SCREEN02.SAV DEL %\OS2\SCREEN01.SYS 2>NUL
IF EXIST %2\OS2\INSTALL\DSPDRVS GOTO PRELOAD
:DISPLAYMESSAGE
%2\os2\wininst\wincopy.cmd %1 %2
:DAMAGED
ECHO ÿ
ECHO ************************************************************
ECHO * This diskette does not contain all necessary files.      *
ECHO ************************************************************
ECHO DAMAGED DISKETTE >> %2\OS2\INSTALL\DISPLAY.LOG
GOTO END
:USAGE
ECHO ÿ
ECHO Usage: MIROINST [INSTALLDRIVE:] [BOOTDRIVE:]
GOTO END
:INSERTDISK
ECHO ************************************************************
ECHO * Insert MIRO Display Driver Diskette                        *
ECHO ************************************************************
pause
GOTO NEXT7
:PRELOAD
IF EXIST %2\OS2\INSTALL\PRELOAD\CONFIG.EXE GOTO COPYPRLDFILES
%2\OS2\UNPACK.EXE S3PRF %2 >NUL
%2\OS2\INSTALL\S3PRF.EXE
DEL %2\OS2\INSTAL\S3PRF.EXE 1>NUL 2>NUL
GOTO DISPLAYMESSAGE
:COPYPRLDFILES
ECHO  Preloaded system configuration >> %2\OS2\INSTALL\DISPLAY.LOG
IF NOT EXIST %1\CONFIG GOTO DAMAGED
IF EXIST %2\OS2\INSTALL\WINSUP.IAM GOTO NEXT6
IF EXIST %2\OS2\INSTALL\PRELOAD\CONFIG.SAV GOTO NEXT5
COPY %2\OS2\INSTALL\PRELOAD\CONFIG.EXE %2\OS2\INSTALL\PRELOAD\CONFIG.SAV >NUL
:NEXT5
%2\OS2\UNPACK %1\CONFIG %2 >NUL
:NEXT6
IF NOT EXIST %1\S3WIN  GOTO INSERTDISK
:NEXT7
IF NOT EXIST %1\S3.DSP GOTO DAMAGED
IF NOT EXIST %1\S3VIDEO GOTO DAMAGED
IF NOT EXIST %1\DISPLAY.DL_ GOTO DAMAGED
COPY %1\S3WIN       %2\OS2\INSTALL\DSPDRVS >NUL
COPY %1\S3.DSP      %2\OS2\INSTALL\DSPDRVS >NUL
COPY %1\S3VIDEO  %2\OS2\INSTALL\DSPDRVS >NUL
COPY %1\DISPLAY.DL_ %2\OS2\INSTALL\DSPDRVS >NUL
GOTO DISPLAYMESSAGE
:END
