@echo off
rem ==================================================
rem File    : SSINST1.BAT
rem ID      : Batch file for DOS called by INSTALL.BAT with 1-2 parameters
rem           Parameter 1 defining the source drive.
rem           Parameter 2 is B for Btrieve or Name of SQL server for SQL
rem Function: To install Sun Programs on a DOS PC
rem Created : Systems Union Ltd, August 1992 / 3
rem ==================================================
rem **************** Syntax for the Install command file *****************
rem  syntax ] SSINST1 Floppy_Drive 
IF "%1" == "" GOTO perror
ECHO Copying SunSystems files from SunSystems disk 1
copy %1\*.EXE >>INSTALL.LOG
copy ssckos2.exe ssck.exe >> INSTAL.LOG
copy %1\*.DAT >>INSTALL.LOG
IF NOT EXIST SUN.INI copy %1\*.INI >>INSTALL.LOG
rem Deleting SunSystem program and screen files
IF EXIST SS*.?NT del SS*.?NT >>INSTALL.LOG
IF EXIST SS*.G0? del SS*.G0? >>INSTALL.LOG
IF EXIST SS*. del SS*. >>INSTALL.LOG
:zipit
pkunzip -o %1\SS1.ZIP >>INSTALL.LOG
IF ERRORLEVEL 1 GOTO errorss1
:ss2disk
ECHO Place the disk marked SunSystems disk 2 into your floppy disk drive
PAUSE
IF NOT EXIST %1SS2.ZIP GOTO errorss2
ECHO Copying SunSystems files from SunSystems disk 2
copy %1\*.EXE >>INSTALL.LOG
pkunzip -o %1\SS2.ZIP >>INSTALL.LOG
IF ERRORLEVEL 1 GOTO errorss2
:rest
IF EXIST SSSYSTEM.DAT GOTO sa
:sa
rem Deleting SunAccount program and screen files
IF EXIST SA*.?NT del SA*.?NT >>INSTALL.LOG
IF EXIST SA*.G0? del SA*.G0? >>INSTALL.LOG
IF EXIST SA*. del SA*. >>INSTALL.LOG
:sf
IF EXIST SF*.?NT del SF*.?NT >>INSTALL.LOG
IF EXIST SF*.G0? del SF*.G0? >>INSTALL.LOG
IF EXIST SF*. del SF*. >>INSTALL.LOG
:sc
IF EXIST SC*.?NT del SC*.?NT >>INSTALL.LOG
IF EXIST SC*.G0? del SC*.G0? >>INSTALL.LOG
IF EXIST SC*. del SC*. >>INSTALL.LOG
:delend
SSCK SA
IF ERRORLEVEL 1 GOTO sadisk
GOTO sb
:sadisk
ECHO Place the disk marked SunAccount into your floppy disk drive
PAUSE
ECHO Copying SunAccount files
IF ERRORLEVEL 6 GOTO allsa
IF ERRORLEVEL 4 GOTO scla
IF ERRORLEVEL 3 GOTO laar
IF ERRORLEVEL 2 GOTO ar
IF ERRORLEVEL 1 GOTO la
:allsa
ECHO         Corporate Allocations
pkunzip -o %1\SC.ZIP >>INSTALL.LOG
IF ERRORLEVEL 1 GOTO errorsa
:laar
ECHO         Asset Register
pkunzip -o %1\SF.ZIP >>INSTALL.LOG
IF ERRORLEVEL 1 GOTO errorsa
GOTO la
:scla
ECHO         Corporate Allocations
pkunzip -o %1\SC.ZIP >>INSTALL.LOG
IF ERRORLEVEL 1 GOTO errorsa
GOTO la
:ar
ECHO         Asset Register
pkunzip -o %1\SF.ZIP >>INSTALL.LOG
IF ERRORLEVEL 1 GOTO errorsa
GOTO saend
:la
ECHO         Ledger Accounting
pkunzip -o %1\LA.ZIP >>INSTALL.LOG
IF ERRORLEVEL 1 GOTO errorsa
:saend
pkunzip -o %1\SA.ZIP >>INSTALL.LOG
IF ERRORLEVEL 1 GOTO errorsa
:sb
rem Deleting SunBusiness program and screen files
IF EXIST SB*.?NT del SB*.?NT >>INSTALL.LOG
IF EXIST SB*.G0? del SB*.G0? >>INSTALL.LOG
IF EXIST SB*. del SB*. >>INSTALL.LOG
:so
IF EXIST SO*.?NT del SO*.?NT >>INSTALL.LOG
IF EXIST SO*.G0? del SO*.G0? >>INSTALL.LOG
IF EXIST SO*. del SO*. >>INSTALL.LOG
:sm
IF EXIST SM*.?NT del SM*.?NT >>INSTALL.LOG
IF EXIST SM*.G0? del SM*.G0? >>INSTALL.LOG
IF EXIST SM*. del SM*. >>INSTALL.LOG
:sp
IF EXIST SP*.?NT del SP*.?NT >>INSTALL.LOG
IF EXIST SP*.G0? del SP*.G0? >>INSTALL.LOG
IF EXIST SP*. del SP*. >>INSTALL.LOG
:delendsb
SSCK SB
IF ERRORLEVEL 1 GOTO sbdisk
GOTO btr_chk
:sbdisk
ECHO Place the disk marked SunBusiness into your floppy disk drive
PAUSE
ECHO Copying SunBusiness files
IF ERRORLEVEL 7 GOTO allsb
IF ERRORLEVEL 6 GOTO popic
IF ERRORLEVEL 5 GOTO popsop
IF ERRORLEVEL 4 GOTO pop
IF ERRORLEVEL 3 GOTO sopic
IF ERRORLEVEL 2 GOTO ic
IF ERRORLEVEL 1 GOTO sop
:allsb
ECHO         Sales Order Processing
pkunzip -o %1\SO.ZIP >>INSTALL.LOG
IF ERRORLEVEL 1 GOTO errorsb
ECHO         Inventory Control
pkunzip -o %1\SM.ZIP >>INSTALL.LOG
IF ERRORLEVEL 1 GOTO errorsb
ECHO         Purchase Order Processing
pkunzip -o %1\SP.ZIP >>INSTALL.LOG
IF ERRORLEVEL 1 GOTO errorsb
GOTO sbend
:popic
ECHO         Inventory Control
pkunzip -o %1\SM.ZIP >>INSTALL.LOG
IF ERRORLEVEL 1 GOTO errorsb
ECHO         Purchase Order Processing
pkunzip -o %1\SP.ZIP >>INSTALL.LOG
IF ERRORLEVEL 1 GOTO errorsb
GOTO sbend
:popsop
ECHO         Sales Order Processing
pkunzip -o %1\SO.ZIP >>INSTALL.LOG
IF ERRORLEVEL 1 GOTO errorsb
ECHO         Purchase Order Processing
pkunzip -o %1\SP.ZIP >>INSTALL.LOG
IF ERRORLEVEL 1 GOTO errorsb
GOTO sbend
:pop
ECHO         Purchase Order Processing
pkunzip -o %1\SP.ZIP >>INSTALL.LOG
IF ERRORLEVEL 1 GOTO errorsb
GOTO sbend
:sopic
ECHO         Sales Order Processing
pkunzip -o %1\SO.ZIP >>INSTALL.LOG
IF ERRORLEVEL 1 GOTO errorsb
ECHO         Inventory Control
pkunzip -o %1\SM.ZIP >>INSTALL.LOG
IF ERRORLEVEL 1 GOTO errorsb
GOTO sbend
:ic
ECHO         Inventory Control
pkunzip -o %1\SM.ZIP >>INSTALL.LOG
IF ERRORLEVEL 1 GOTO errorsb
GOTO sbend
:sop
ECHO         Sales Order Processing
pkunzip -o %1\SO.ZIP >>INSTALL.LOG
IF ERRORLEVEL 1 GOTO errorsb
GOTO sbend
:sbend
pkunzip -o %1\SB.ZIP >>INSTALL.LOG
IF ERRORLEVEL 1 GOTO errorsb
REM added 19/2/93 - DG for BTRIEVE Installation
rem -----------------------------------------------------
rem Btrieve and SQL sections
rem -----------------------------------------------------
:btr_chk
IF "%2" == "B" GOTO btr
IF "%2" == "b" GOTO btr
IF "%2" == ""  GOTO iq_chk
rem -----------------------------------------------------
:sql
ECHO SunLink/SQL Installation has been requested therefore replace
ECHO the disk marked SunSystems disk 2 into your floppy disk drive
PAUSE
IF NOT EXIST %1\sql1.ZIP GOTO errors1
pkunzip -o %1\sql1.ZIP >>INSTALL.LOG
IF ERRORLEVEL 1 GOTO errors2
IF NOT EXIST %1\sql2.ZIP GOTO errors1
md _sql
pkunzip -o %1\sql2.ZIP _sql >>INSTALL.LOG
IF ERRORLEVEL 1 GOTO errors2
echo server=%2 >> sun.ini
echo database=SUN40 >> sun.ini
goto iq_chk
:btr
ECHO SunLink/Btrieve Installation has been requested therefore replace
ECHO the disk marked SunSystems disk 2 into your floppy disk drive
PAUSE
IF NOT EXIST %1\btr1.ZIP GOTO errorb1
pkunzip -o %1\btr1.ZIP >>INSTALL.LOG
IF ERRORLEVEL 1 GOTO errorbt2
IF NOT EXIST %1\btr2.ZIP GOTO errorb1
md _ddf
pkunzip -o %1\btr2.ZIP _ddf >>INSTALL.LOG
IF ERRORLEVEL 1 GOTO errorb2
:iq_chk
REM ** this bit removed: SSCK SQ
REM ** this bit removed: IF ERRORLEVEL 1 GOTO sq
REM the following prompt replaces the 2 lines above
ECHO ****************************************************
ECHO Do you wish to install SunQuery?
ECHO If Yes, type Y, then Return key
ECHO If not then type N, then Return key
ECHO ****************************************************
SSCK ?YN
if errorlevel 1 goto demo
GOTO sq
:sq
ECHO Place the disk marked SunQuery into your floppy disk drive
PAUSE
ECHO.
ECHO Creating _SQ directory
MD _SQ
echo.
ECHO please wait....
IF NOT EXIST _sq\IQ.EXE GOTO CSQ
md _sq\_squpd
ECHO You are already a current user in a directory %2%3\_SQ
ECHO creating a new directory under %2%3\_SQ as _SQUPD and
ECHO copying new SunQuery files there..
ECHO.
ECHO **************************************************************
ECHO.
ECHO Please run the UPDATE batch file from %2%3\_SQ to assist
ECHO your upgrade when the installation is complete.
ECHO.
ECHO ***************************************************************
ECHO.
ECHO Copying SunQuery files
copy %1\UPDATE.BAT   _SQ\_SQUPD >> INSTALL.LOG
pkunzip -o %1\SQ.ZIP _sq\_squpd >> install.log
if errorlevel 1 goto errorsq
ECHO Replacing file-handler files in Sun directory
COPY _SQ\_SQUPD\SSFH*.GNT  >> INSTALL.LOG
DEL  _SQ\_SQUPD\SSFH*.GNT  >> INSTALL.LOG
goto sqdemo
:CSQ
ECHO Copying SunQuery files
pkunzip -o %1\SQ.ZIP _SQ >>INSTALL.LOG
IF ERRORLEVEL 1 GOTO errorsq
ECHO Replacing file-handler files in Sun directory
COPY _SQ\SSFH*.GNT  >> INSTALL.LOG
DEL  _SQ\SSFH*.GNT  >> INSTALL.LOG
:sqdemo
ECHO ****************************************************
rem  NB This is the special Non-compressed version!!!
ECHO Do you wish to install the Demonstration Data?
ECHO If Yes, type Y, then Return key
ECHO If not then type N, then Return key
ECHO ****************************************************
SSCK ?YN
if errorlevel 1 goto end
ECHO Copying Demonstration Data
pkunzip -o %1\SQDEMO.ZIP _data >>INSTALL.LOG
copy _data\SSRF-SKL.BAK _back >>INSTALL.LOG
del  _data\SSRF-SKL.BAK >>INSTALL.LOG
IF ERRORLEVEL 1 GOTO errorsq
GOTO end
:demo
ECHO ****************************************************
ECHO Do you wish to install the Demonstration Data?
ECHO If Yes, place the disk marked Demonstration Data
ECHO into your floppy disk drive, type Y, then Return key
ECHO If not then type N, then Return key
ECHO ****************************************************
SSCK ?YN
if errorlevel 1 goto end
ECHO Copying Demonstration Data
IF "%2" == "" GOTO  demo_dat
:demo_bak
rem Backup versions of the files ,must be issued for SQL and Btrieve
pkunzip -o %1\DEMOBAK.ZIP _back >>INSTALL.LOG
IF ERRORLEVEL 1 GOTO errord
GOTO end
:demo_dat
rem Cobol ISAM files issued as standard.
pkunzip -o %1\DEMO.ZIP _data >>INSTALL.LOG
IF ERRORLEVEL 1 GOTO errord
ECHO _data\SSRF-SKL.BAK >>INSTALL.LOG
copy _data\SSRF-SKL.BAK _back >>INSTALL.LOG
del  _data\SSRF-SKL.BAK >>INSTALL.LOG
IF ERRORLEVEL 1 GOTO errord
GOTO end
rem ------------------ error sections ------------------------------
:perror
ECHO Source Drive must be defined - Use INSTALL
GOTO :finish
:errorss1
ECHO There has been a problem copying your SunSystems diskette 1
ECHO Check that the correct diskette has been used and restart
ECHO the installation from the beginning.
vol %1
GOTO finish
:errorss2
ECHO There has been a problem copying your SunSystems diskette 2
ECHO Check that the correct diskette has been used and restart
ECHO the installation from the beginning.
vol %1
GOTO finish
:errorsa
ECHO There has been a problem copying your SunAccount diskette
ECHO Check that the correct diskette has been used.
vol %1
GOTO sa
:errorsb
ECHO There has been a problem copying your SunBusiness diskette
ECHO Check that the correct diskette has been used.
vol %1
GOTO sb
:errors1
ECHO There has been a problem installing the SunLink/SQL files
ECHO You requested SunLink/SQL but the disk does not contain SQL1.ZIP
vol %1
GOTO sql
:errors2
ECHO There has been a problem installing the SunLink/SQL files
ECHO There was a problem unzipping the files
vol %1
GOTO sql
:errorb1
ECHO There has been a problem installing the SunLink/Btrieve files
ECHO You requested Btrieve but the disk does not contain BTRV1.ZIP
vol %1
GOTO btr
:errorb2
ECHO There has been a problem installing the SunLink/Btrieve files
ECHO There was a problem unzipping the files
vol %1
GOTO btr
:errorsq
ECHO There has been a problem copying your SunQuery diskette
ECHO Check that the correct diskette has been used.
vol %1
GOTO iq_chk
:errord
ECHO There has been a problem copying your Demonstration diskette
ECHO Check that the correct diskette has been used.
vol %1
GOTO demo
rem ------------------- end -----------------------------------------
:end
del  PKUNZIP.EXE >>INSTALL.LOG
del  SSCK.EXE >>INSTALL.LOG
del  SSCKOS2.EXE >>INSTALL.LOG
ECHO **** Installation Complete ****
:finish

