echo off
cls
echo ------------------------------------------------------------------------------
echo          -- INSTALLATION PROGRAM FOR TURBO PASCAL 6.0 SYSTEM UNIT --
echo             Copyright (c) 1990,1991 by Eagle Performance Software
echo ------------------------------------------------------------------------------
if not exist TURBO.TPL    goto NOLIB
if not exist SYS60A.TPU   goto NOTPU
if     exist TPL-EPS.TPL  goto ALREADY
if     exist TPL-BOR.TPL  goto ALREADY
if     exist SYSTEM.TPU   goto CLEANUP
tpumover nul.tpl -nul.tpu >nul
if not errorlevel 1 goto NOMOVER
echo   Making backup copy of TURBO.TPL into TPL-BOR.TPL...
copy turbo.tpl tpl-bor.tpl >nul
echo   Creating new  copy of TURBO.TPL into TPL-EPS.TPL...
copy turbo.tpl tpl-eps.tpl >nul
echo   Deleting Turbo's SYSTEM.TPU...
tpumover tpl-eps.tpl -system
if errorlevel 1 goto BADMOVER1
ren  sys60a.tpu system.tpu
echo   Adding Eagle's   SYSTEM.TPU...
tpumover tpl-eps.tpl +system
if errorlevel 1 goto BADMOVER2
del  system.tpu
echo   Installing updated library TURBO.TPL ...
copy tpl-eps.tpl turbo.tpl >nul
echo ------------------------------------------------------------------------------
echo               Installation complete!  Enjoy your faster programs.
echo                 -- Shareware by Eagle Performance Software --
echo ------------------------------------------------------------------------------
goto EXIT

:NOLIB
echo Your TURBO.TPL library cannot be found.  Check to see if you are running
echo this installation in your Turbo Pascal directory.
goto HALT
:NOTPU
echo Your SYS60A.TPU unit cannot be found.  Check to see if you have already
echo installed the unit and are attempting to install it a second time.
goto HALT
:NOMOVER
echo Your TPUMOVER.EXE program cannot be found.  Be sure that this program can
echo be accessed by the path or is found in your Turbo Pascal directory.
goto HALT
:CLEANUP
echo The SYSTEM.TPU file has not been moved out of your directory.  Relocate
echo this file to keep it from being overwritten.
goto HALT
:BADMOVER2
ren system.tpu sys60a.tpu
:BADMOVER1
echo The TPUMOVER program maybe the wrong version...
echo   Deleting TPL-BOR.TPL and TPL-EPS.TPL...
del tpl-bor.tpl
del tpl-eps.tpl
goto HALT
:ALREADY
echo The TPL-BOR.TPL/TPL-EPS.TPL libraries already exist.  You are attempting to
echo install the unit a second time...
echo If you are upgrading SYS, then be sure that TURBO.TPL is Borland's original
echo library by copying TPL-BOR.TPL to TURBO.TPL.  Then delete TPL-BOR.TPL and
echo TPL-EPS.TPL and run SYS60A.BAT again...

:HALT
echo ----------------- The installation has NOT been completed. -------------------

:EXIT