echo off
cls
if %2. == . goto DRIVE-A

if not exist %2LICENSE.TXT goto ABORT-L
if not exist %2AGREEMNT.TXT goto ABORT-L
:LICENSE2
cls
type %2LICENSE.TXT
:GETCHL-2
%2getch
if errorlevel 89 goto GETCHL-2
if errorlevel 88 goto LEAVE
if errorlevel 87 goto GETCHL-2
if errorlevel 86 goto SHOWLIC2
if errorlevel 68 goto GETCHL-2
if errorlevel 67 goto LIC-OK
if errorlevel 1 goto GETCHL-2

:SHOWLIC2
cls
type %2AGREEMNT.TXT | MORE
%2getch
goto LICENSE2

:DRIVE-A
if not exist a:\LICENSE.TXT goto ABORT-L
if not exist a:\AGREEMNT.TXT goto ABORT-L

:LICENSE1
cls
type a:\license.txt
:GETCHL-A
a:\getch
if errorlevel 89 goto GETCHL-A
if errorlevel 88 goto LEAVE
if errorlevel 87 goto GETCHL-A
if errorlevel 86 goto SHOWLIC1
if errorlevel 68 goto GETCHL-A
if errorlevel 67 goto LIC-OK
if errorlevel 1 goto GETCHL-A

:SHOWLIC1
cls
type a:\AGREEMNT.TXT | MORE
a:\getch
goto LICENSE1

:LIC-OK
cls
cd\
REM -- VersaCAD installation. (1.44mb)
REM -- This batch expects the hard disk as the current drive.
REM -- The first parameter (%1) is the boot drive (ex. C:).
REM -- The second parameter may be set (%2) as install from drive (ex. B:).

REM -- Make sure there is a boot drive (%1).
if %1. == . goto NOBOOT
cd %1\

REM -- Don't try to install the system on the master diskette.
if not exist install.bat goto VALDISK
if not exist vcad80.exe goto VALDISK
goto ABORT
REM -- this must be the master disk.  DO NOT TRY TO INSTALL ON THE MASTER DISK!

:VALDISK
cls
echo ÿ
echo                      INSTALLATION FOR VERSACAD
echo ÿ
echo      This installation requires the following:
echo        640 K of conventional memory.
echo        15 MB of hard disk space free if installing all modules.
echo ÿ
echo      It will create the directory VCAD80 on the root of your current
echo      volume and a number of sub-directories under that.
echo ÿ
echo ÿ
echo      [F1]  Continue with installation.
echo ÿ
echo      [F2]  Exit to Operating system.
echo ÿ
if %2. == . goto GETCH2
:GETCH1
%2GETCH
if errorlevel 130 goto GETCH1
if errorlevel 129 goto EXIT
if errorlevel 128 goto HDISK
if errorlevel 1 goto GETCH1

:GETCH2
A:GETCH
if errorlevel 130 goto GETCH2
if errorlevel 129 goto EXIT
if errorlevel 128 goto HDISK
if errorlevel 1 goto GETCH2

:HDISK
echo ÿ
echo Please wait while directories are created and files are copied.
echo If directories already exist some error messages may be displayed.
echo ÿ

if not exist vcad80\*.*            md vcad80 > NUL
if not exist vcad80\spool\*.*      md vcad80\spool > NUL
if not exist vcad80\utils\*.*      md vcad80\utils > NUL
if not exist vcad80\v2d\*.*        md vcad80\v2d > NUL
if not exist vcad80\v2d\custom\*.* md vcad80\v2d\custom > NUL
if not exist vcad80\v2d\draw\*.*   md vcad80\v2d\draw > NUL
if not exist vcad80\v2d\fonts\*.*  md vcad80\v2d\fonts > NUL
if not exist vcad80\v2d\lib\*.*    md vcad80\v2d\lib > NUL
if not exist vcad80\v3d\*.*        md vcad80\v3d > NUL
if not exist vcad80\v3d\custom\*.* md vcad80\v3d\custom > NUL
if not exist vcad80\v3d\lib\*.*    md vcad80\v3d\lib > NUL
if not exist vcad80\v3d\object\*.* md vcad80\v3d\object > NUL
if not exist vcad80\v3d\scene\*.*  md vcad80\v3d\scene > NUL
if not exist vcad80\v3d\shade\*.*  md vcad80\v3d\shade > NUL
if not exist vcad80\vbm\*.*        md vcad80\vbm > NUL
if not exist vcad80\vbm\custom\*.* md vcad80\vbm\custom > NUL
if not exist vcad80\vbm\report\*.* md vcad80\vbm\report > NUL
if not exist vcad80\vbm\tables\*.* md vcad80\vbm\tables > NUL

REM --- SAVE OLD ENVIRO! 
if exist \vcad80\enviro.env copy \vcad80\enviro.env \vcad80\enviro.80 > NUL

cls
echo ÿ
echo Please wait while files are copied and exploded...
echo ÿ

if %2. == . goto SETA
copy %2\vcad80.exe vcad80.exe > NUL
vcad80 -d -o
if errorlevel 1 goto NOROOM
del vcad80.exe > NUL
\vcad80\install2 %1 %2

:SETA
copy a:\vcad80.exe vcad80.exe > NUL
vcad80 -d -o
if errorlevel 1 goto NOROOM
del vcad80.exe > NUL
\vcad80\install2 %1 a:

:NOROOM
cls
del vcad80.exe
echo VERSACAD was not copied successfully to the hard disk.
echo Check to see if there is room on the hard disk and start again when the
echo system prompt appears.
goto EXIT

:ABORT-L
if %2. == . goto ABORT-LA
cls
echo Unable to find LICENSE.TXT or AGREEMNT.TXT on drive %b
echo To install off of drive B: onto drive C:,
echo  type  c: [enter]  to make drive C: the current directory,
echo  then type b:install c: b: [enter] to begin again.
goto EXIT
:ABORT-LA
cls
echo Unable to find LICENSE.TXT or AGREEMNT.TXT on drive A:
echo To install off of drive A: onto drive C:,
echo  type  c: [enter]  to make drive C: the current directory,
echo  then type a:install c: [enter] to begin again.
goto EXIT

:ABORT
if %2. == . goto ABORTA
cls
echo The master disk is the root directory which indicates you may be
echo copying the Drafting program to drive %2.  To install on drive C:,
echo type  c: [enter]  to make drive C: the current directory, then type
echo %2install c: %2 [enter]  to begin again.
goto EXIT
:ABORTA
cls
echo The master disk is the root directory which indicates you may be
echo copying the Drafting program to drive A:.  To install on drive C:,
echo type  c: [enter]  to make drive C: the current directory, then type
echo a:install c: [enter]  to begin again.
goto EXIT

:LEAVE
cls
goto EXIT

:NOBOOT
cls
echo ÿ
echo You must specify your boot drive (ex. a:install c:).
:EXIT
cd \
