@echo off
set t=%1
set w=%2
set STDOUT=NUL
set STDERR=NUL
set CHGATTR=CHGATTR
set UNPACK=%t%\OS2\UNPACK
set COPY=COPY
set ERASE=ERASE

:csd1
%CHGATTR%               %t%\OS2KRNL 32       1>%STDOUT% 2>%STDERR%

@echo System files are being copy ...
@echo .
%UNPACK%    OS2KRNL.*   %t%\                 1>%STDOUT% 2>%STDERR%
%CHGATTR%               %t%\OS2KRNL 7        1>%STDOUT% 2>%STDERR%
@echo Revised modules are being copy...
@echo .
IF EXIST %t%\OS2\MDOS\COMMAND.COM            %UNPACK% COMMAND.CO@   %t%\OS2\MDOS\     1>%STDOUT% 2>%STDERR%
IF EXIST %t%\OS2\DLL\DOSCALL1.DLL            %UNPACK% DOSCALL1.DL@  %t%\OS2\DLL\      1>%STDOUT% 2>%STDERR%
IF EXIST %t%\OS2\DLL\PMGPI.DLL               %UNPACK% PMGPI.DL@     %t%\OS2\DLL\      1>%STDOUT% 2>%STDERR%
IF EXIST %t%\OS2\DLL\PMGRE.DLL               %UNPACK% PMGRE.DL@     %t%\OS2\DLL\      1>%STDOUT% 2>%STDERR%
IF EXIST %t%\OS2\DLL\WPCONFIG.DLL            %UNPACK% WPCONFIG.DL@  %t%\OS2\DLL\      1>%STDOUT% 2>%STDERR%
IF EXIST %t%\OS2\SYSDATA\$TWNZN16.FNT        %UNPACK% $TWNZN16.FN@  %t%\OS2\SYSDATA\  1>%STDOUT% 2>%STDERR%

:csd2
@echo@Please insert the "CSD - 2" diskette into drive A.
pause
IF NOT EXIST BVHVGA2.DL@ goto csd2
IF EXIST %t%\OS2\DLL\BVHVGA2.DLL             %UNPACK% BVHVGA2.DL@   %t%\OS2\DLL\      1>%STDOUT% 2>%STDERR%
CHKDEV32 %t%\OS2\DLL\IBMDEV32.DLL
if ERRORLEVEL 7 goto SVGA768unpack
if ERRORLEVEL 6 goto SVGA600unpack
if ERRORLEVEL 5 goto SVGA480unpack
if ERRORLEVEL 4 goto DEVunpack
if ERRORLEVEL 3 goto JC08unpack
if ERRORLEVEL 2 goto JC05unpack
if ERRORLEVEL 1 goto JC04unpack
goto E_32

:JC04unpack
@echo IBMJC04.DLL is being unpack...
@echo . . .
%UNPACK%  IBMJC04.DL@ %T%\OS2\DLL\                              1>%STDOUT%  2>%STDERR%
%COPY%    %T%\OS2\DLL\IBMJC04.DLL %T%\OS2\DLL\IBMDEV32.DLL      1>%STDOUT%  2>%STDERR%
%ERASE%   %T%\OS2\DLL\IBMJC04.DLL                               1>%STDOUT%  2>%STDERR%
goto VGAunpack

:JC05unpack
@echo IBMJC05.DLL is being unpack...
@echo . . .
%UNPACK%  IBMJC05.DL@ %T%\OS2\DLL\                              1>%STDOUT%  2>%STDERR%
%COPY%    %T%\OS2\DLL\IBMJC05.DLL %T%\OS2\DLL\IBMDEV32.DLL      1>%STDOUT%  2>%STDERR%
%ERASE%   %T%\OS2\DLL\IBMJC05.DLL                               1>%STDOUT%  2>%STDERR%
goto VGAunpack

:JC08unpack
@echo IBMJC08.DLL is being unpack...
@echo . . .
%UNPACK%  IBMJC08.DL@ %T%\OS2\DLL\                              1>%STDOUT%  2>%STDERR%
%COPY%    %T%\OS2\DLL\IBMJC08.DLL %T%\OS2\DLL\IBMDEV32.DLL      1>%STDOUT%  2>%STDERR%
%ERASE%   %T%\OS2\DLL\IBMJC08.DLL                               1>%STDOUT%  2>%STDERR%
goto VGAunpack

:DEVunpack
@echo IBMDEVR.DLL is being unpack...
@echo . . .
%UNPACK%  IBMDEVR.DL@ %T%\OS2\DLL\                              1>%STDOUT%  2>%STDERR%
%COPY%    %T%\OS2\DLL\IBMDEVR.DLL %T%\OS2\DLL\IBMDEV32.DLL      1>%STDOUT%  2>%STDERR%
%ERASE%   %T%\OS2\DLL\IBMDEVR.DLL                               1>%STDOUT%  2>%STDERR%
goto VGAunpack

:SVGA480unpack
@echo SV480256.DLL is being unpack...
@echo . . .
%UNPACK%  SV480256.DL@ %T%\OS2\DLL\                             1>%STDOUT%  2>%STDERR%
%COPY%    %T%\OS2\DLL\SV480256.DLL %T%\OS2\DLL\IBMDEV32.DLL     1>%STDOUT%  2>%STDERR%
%ERASE%   %T%\OS2\DLL\SV480256.DLL                              1>%STDOUT%  2>%STDERR%
goto VGAunpack

:SVGA600unpack
@echo SV600256.DLL is being unpack...
@echo . . .
%UNPACK%  SV600256.DL@ %T%\OS2\DLL\                             1>%STDOUT%  2>%STDERR%
%COPY%    %T%\OS2\DLL\SV600256.DLL %T%\OS2\DLL\IBMDEV32.DLL     1>%STDOUT%  2>%STDERR%
%ERASE%   %T%\OS2\DLL\SV600256.DLL                              1>%STDOUT%  2>%STDERR%
goto VGAunpack

:SVGA768unpack
@echo SV768256.DLL is being unpack...
@echo . . .
%UNPACK%  SV768256.DL@ %T%\OS2\DLL\                             1>%STDOUT%  2>%STDERR%
%COPY%    %T%\OS2\DLL\SV768256.DLL %T%\OS2\DLL\IBMDEV32.DLL     1>%STDOUT%  2>%STDERR%
%ERASE%   %T%\OS2\DLL\SV768256.DLL                              1>%STDOUT%  2>%STDERR%

:VGAunpack
@echo IBMVGAR.DLL is being unpack...
@echo . . .
%UNPACK%  IBMVGA32.DL@ %T%\OS2\DLL\                             1>%STDOUT%  2>%STDERR%
:E_32

IF EXIST %t%\OS2\DLL\IBMS332.DLL                 %UNPACK% IBMS332.DL@     %t%\OS2\DLL\                 1>%STDOUT% 2>%STDERR%
IF EXIST %t%\OS2\DLL\IBMXG32D.DLL                %UNPACK% IBMXG32D.DL@    %t%\OS2\DLL\                 1>%STDOUT% 2>%STDERR%
IF EXIST %t%\OS2\INSTALL\INSTALL.EXE             %UNPACK% INSTALL.EX@     %t%\OS2\INSTALL\             1>%STDOUT% 2>%STDERR%
IF EXIST %w%\OS2\MDOS\WINOS2\SYSTEM\SW55DSP4.DRV %UNPACK% SW55DSP4.DR@    %w%\OS2\MDOS\WINOS2\SYSTEM\  1>%STDOUT% 2>%STDERR%
IF EXIST %w%\OS2\MDOS\WINOS2\SYSTEM\SW55DSP8.DRV %UNPACK% SW55DSP8.DR@    %w%\OS2\MDOS\WINOS2\SYSTEM\  1>%STDOUT% 2>%STDERR%

CHKDEV32 %t%\OS2\DLL\IBMDEV32.DLL
if ERRORLEVEL 4 goto VGAs
if ERRORLEVEL 1 goto PS55DISPLAY
goto E_VGA

:VGAs
@echo VGA  VVGA.SYS is being unpack...
@echo . . .
%UNPACK%  VVGA2.SY@      %T%\OS2\MDOS\                 1>%STDOUT%  2>%STDERR%
%COPY%    %T%\OS2\MDOS\VVGA2.SYS %T%\OS2\MDOS\VVGA.SYS 1>%STDOUT%  2>%STDERR%
%ERASE%   %T%\OS2\MDOS\VVGA2.SYS                       1>%STDOUT%  2>%STDERR%
goto E_VGA

:PS55DISPLAY
@echo PS/55 Display Adapter VVGA.SYS is being unpack...
@echo . . .
%UNPACK%  VVGA.SY@       %T%\OS2\MDOS\                 1>%STDOUT%  2>%STDERR%
:E_VGA
IF EXIST %t%\OS2\MDOS\VSVGA.SYS        %UNPACK% VSVGA.SY@    %t%\OS2\MDOS\         1>%STDOUT% 2>%STDERR%
IF EXIST %t%\OS2\MDOS\VWIN.SYS         %UNPACK% VWIN.SY@     %t%\OS2\MDOS\         1>%STDOUT% 2>%STDERR%
IF EXIST %t%\OS2\DLL\CNVUTL.DLL        %UNPACK% CNVUTL.DL@   %t%\OS2\DLL\          1>%STDOUT% 2>%STDERR%
IF EXIST %t%\OS2\DLL\TTFD.DLL          %UNPACK% TTFD.DL@     %t%\OS2\DLL\          1>%STDOUT% 2>%STDERR%

:csd3
@echo@Please insert the "CSD - 3" diskette into drive A.
pause
IF NOT EXIST IMMON.EX@ goto csd3
CHKKBD %t%\OS2\KEYBOARD.DCP
if ERRORLEVEL 2 goto ISA101
if ERRORLEVEL 1 goto ISA5576
goto KBDPASS

:ISA101
@echo 101 keyboard modules is being unpack...
@echo . . .
IF EXIST %t%\OS2\IMMON.EXE            %UNPACK% USKBD\IMMON.EX@     %t%\OS2\        1>%STDOUT% 2>%STDERR%
IF EXIST %t%\OS2\DLL\PMNLSFEP.DLL     %UNPACK% USKBD\PMNLSFEP.DL@  %t%\OS2\DLL\    1>%STDOUT% 2>%STDERR%
IF EXIST %t%\OS2\DLL\PMNLSJP2.DLL     %UNPACK% USKBD\PMNLSJP2.DL@  %t%\OS2\DLL\    1>%STDOUT% 2>%STDERR%
IF EXIST %t%\OS2\DLL\PMNLSSSC.DLL     %UNPACK% USKBD\PMNLSSSC.DL@  %t%\OS2\DLL\    1>%STDOUT% 2>%STDERR%
IF EXIST %t%\OS2\DLL\PMNLSUN1.DLL     %UNPACK% USKBD\PMNLSUN1.DL@  %t%\OS2\DLL\    1>%STDOUT% 2>%STDERR%
IF EXIST %t%\OS2\DLL\PMWIN.DLL        %UNPACK% USKBD\PMWIN.DL@     %t%\OS2\DLL\    1>%STDOUT% 2>%STDERR%
IF EXIST %t%\OS2\VDMIMFEP.EXE         %UNPACK% USKBD\VDMIMFEP.EX@  %t%\OS2\        1>%STDOUT% 2>%STDERR%
IF EXIST %t%\OS2\IMINFO.PRO           %UNPACK% USKBD\IMINFO.PR@    %t%\OS2\        1>%STDOUT% 2>%STDERR%
goto KBDPASS

:ISA5576
@echo PS/55 keyboard modules is being unpack...
@echo . . .
IF EXIST %t%\OS2\IMMON.EXE            %UNPACK% IMMON.EX@     %t%\OS2\              1>%STDOUT% 2>%STDERR%
IF EXIST %t%\OS2\DLL\PMNLSFEP.DLL     %UNPACK% PMNLSFEP.DL@  %t%\OS2\DLL\          1>%STDOUT% 2>%STDERR%
IF EXIST %t%\OS2\DLL\PMNLSJP2.DLL     %UNPACK% PMNLSJP2.DL@  %t%\OS2\DLL\          1>%STDOUT% 2>%STDERR%
IF EXIST %t%\OS2\DLL\PMNLSSSC.DLL     %UNPACK% PMNLSSSC.DL@  %t%\OS2\DLL\          1>%STDOUT% 2>%STDERR%
IF EXIST %t%\OS2\DLL\PMNLSUN1.DLL     %UNPACK% PMNLSUN1.DL@  %t%\OS2\DLL\          1>%STDOUT% 2>%STDERR%
IF EXIST %t%\OS2\DLL\PMWIN.DLL        %UNPACK% PMWIN.DL@     %t%\OS2\DLL\          1>%STDOUT% 2>%STDERR%
IF EXIST %t%\OS2\VDMIMFEP.EXE         %UNPACK% VDMIMFEP.EX@  %t%\OS2\              1>%STDOUT% 2>%STDERR%
IF EXIST %t%\OS2\IMINFO.PRO           %UNPACK% IMINFO.PR@    %t%\OS2\              1>%STDOUT% 2>%STDERR%

:KBDPASS

IF EXIST %t%\OS2\RC.EXE               %UNPACK% RC.EX@        %t%\OS2\              1>%STDOUT% 2>%STDERR%
IF EXIST %t%\OS2\RCPP.EXE             %UNPACK% RCPP.EX@      %t%\OS2\              1>%STDOUT% 2>%STDERR%
IF EXIST %t%\OS2\INSTALL\SEDISK.EXE   %UNPACK% SEDISK.EX@    %t%\OS2\INSTALL\      1>%STDOUT% 2>%STDERR%
IF EXIST %t%\OS2\INSTALL\SEINST.EXE   %UNPACK% SEINST.EX@    %t%\OS2\INSTALL\      1>%STDOUT% 2>%STDERR%
IF EXIST %t%\OS2\INSTALL\SEMAINT.EXE  %UNPACK% SEMAINT.EX@   %t%\OS2\INSTALL\      1>%STDOUT% 2>%STDERR%
IF EXIST %t%\OS2\HELP\INSTALL.HLP     %UNPACK% INSTALL.HL@   %t%\OS2\HELP\         1>%STDOUT% 2>%STDERR%
IF EXIST %t%\OS2\HELP\DSPINSTL.HLP    %UNPACK% DSPINSTL.HL@  %t%\OS2\HELP\         1>%STDOUT% 2>%STDERR%
IF EXIST %t%\OS2\CNVUTPM.EXE          %UNPACK% CNVUTPM.EX@   %t%\OS2\              1>%STDOUT% 2>%STDERR%
IF EXIST %t%\OS2\SVGA.EXE             %UNPACK% SVGA.EX@      %t%\OS2\              1>%STDOUT% 2>%STDERR%
IF EXIST %t%\OS2\INSTALL\UNINSTAL.EXE %UNPACK% UNINSTAL.EX@  %t%\OS2\INSTALL\      1>%STDOUT% 2>%STDERR%
IF EXIST %t%\OS2\INSTALL\RSPINST.EXE  %UNPACK% RSPINST.EX@   %t%\OS2\INSTALL\      1>%STDOUT% 2>%STDERR%
IF EXIST %t%\OS2\DLL\PMNLSSTS.DLL     %UNPACK% PMNLSSTS.DL@  %t%\OS2\DLL\          1>%STDOUT% 2>%STDERR%
IF EXIST %t%\OS2\DLL\PMNLSFM.DLL      %UNPACK% PMNLSFM.DL@   %t%\OS2\DLL\          1>%STDOUT% 2>%STDERR%
IF EXIST %t%\OS2\DLL\PMNLSFD1.FDR     %UNPACK% PMNLSFD1.FD@  %t%\OS2\DLL\          1>%STDOUT% 2>%STDERR%
IF EXIST %t%\OS2\DLL\PMNLSFD2.FDR     %UNPACK% PMNLSFD2.FD@  %t%\OS2\DLL\          1>%STDOUT% 2>%STDERR%
IF EXIST %t%\OS2\DLL\PMMLE.DLL        %UNPACK% PMMLE.DL@     %t%\OS2\DLL\          1>%STDOUT% 2>%STDERR%
IF EXIST %t%\OS2\DLL\PMATM.DLL        %UNPACK% PMATM.DL@     %t%\OS2\DLL\          1>%STDOUT% 2>%STDERR%
IF EXIST %t%\OS2\DLL\PMSHAPI.DLL      %UNPACK% PMSHAPI.DL@   %t%\OS2\DLL\          1>%STDOUT% 2>%STDERR%
IF EXIST %t%\OS2\DLL\IMP.DLL          %UNPACK% IMP.DL@       %t%\OS2\DLL\          1>%STDOUT% 2>%STDERR%

@echo End of CSD Installation.
@echo If CSD diskette installation complete,
@echo please remove the diskette from drive A,
@echo then press and hold Ctrl+Alt and press Del to restart the system.

ptf_end.cmd %0
