@echo off
cls
if %1.==. goto usage
if %2.==. goto usage
if %1==a goto flop
if %1==A goto flop
if %1==b goto flop
if %1==B goto flop
if %1==c goto hdc
if %1==C goto hdc
if %1==d goto hdd
if %1==D goto hdd
if %1==e goto hde
if %1==E goto hde
if %1==f goto hdf
if %1==F goto hdf
echo.
echo Invalid Source Drive:  %1:
goto usage
:flop
if %2==c goto start
if %2==C goto start
if %2==d goto start
if %2==D goto start
if %2==e goto start
if %2==E goto start
if %2==f goto start
if %2==F goto start
echo.
echo Invalid Destination Hard Drive:  %2:
goto usage
:hdc
if %2==%1 goto start
echo.
echo Can't Install from %1: to %2: !     (Don't mix Case of drive letters)
goto usage
:hdd
if %2==%1 goto start
echo.
echo Can't Install from %1: to %2: !    (Don't mix Case of drive letters)
goto usage
:hde
if %2==%1 goto start
echo.
echo Can't Install from %1: to %2: !    (Don't mix Case of drive letters)
goto usage
:hdf
if %2==%1 goto start
echo.
echo Can't Install from %1: to %2: !    (Don't mix Case of drive letters)
goto usage

:start
if exist %1:\jnos_pkg.exe goto start2
echo.
echo Cannot Find File on Source Drive:  %1: ?
echo Please check your setup
echo.
echo If installing FROM the Hard Drive, both the INSTALL & EXE's must
echo be in the ROOT (%1:\) to run correctly.
echo.
goto usage

:start2
if exist \jnos_pkg.exe goto begin
echo.
echo Please change to the %1 Drive first! 
echo Do NOT say:  
echo.
echo %1:install %1 %2
echo.
echo Instead use:
echo.
echo %1:
echo install %1 %2 
echo.
echo.
echo.
echo Install will now exit -
pause
goto end

:usage
echo.
echo.
echo Usage: INSTALL (source) (dest_harddrive)
echo.
echo Example: install a c
echo.
echo Do NOT include colon after letter!
echo.
echo Valid drives: A-F
echo.
echo NOTE: You can NOT install from one Hard Drive to Another
echo       (i.e. you can't install from C: to D:)
echo       And you can NOT install onto a FLOPPY! (not enough space!)
echo.
pause
goto end

:begin
cls
echo ******************* BAYCOM VERSION OF JNOS ***********************
echo.
echo This file will now Install JNOS Version 1.11x5/NNNax on your %2 Drive
echo under the %2:\HAM\NOS directory. This is the default setup directory.
echo.
echo If this is NOT the CORRECT Drive, Abort and re-run the INSTALL program
echo using the format: INSTALL (source) (dest)
echo.
echo If OK to continue, press any key. Otherwise press CTRL-C to Abort.
echo.
pause
%2:
cd \
if exist \ham\nos\autoexec.nos goto backup
if exist \ham\nos\ftpusers goto backup
if exist \ham\nos\alias goto backup
if exist \ham\nos\net.rc goto backup
goto extract
:backup
cls
echo.
echo The INSTALL program has found files that indicate a previous installation
echo of a Plug & Play Package. The following files will be renamed to .ORG so
echo that you will have the original copies of these files.
echo.
echo  AUTOEXEC.NOS   to   AUTOEXEC.ORG
echo  FTPUSERS       to   FTPUSERS.ORG
echo  ALIAS          to   ALIAS.ORG
echo  NET.RC         to   NET.ORG
echo  *.SIG          to   *.ORG
echo  SEQUENCE.SEQ   located in SPOOL\MQUEUE   to   SPOOL\SEQUENCE.ORG
echo  HISTORY        located in SPOOL\NEWS     to   SPOOL\HISTORY.ORG
echo  NNTP.DAT       located in SPOOL\NEWS     to   SPOOL\NNTP.ORG
echo.
rem AUTOEXEC.NOS
if exist \ham\nos\autoexec.org erase \ham\nos\autoexec.org >NUL
if exist \ham\nos\autoexec.nos ren \ham\nos\autoexec.nos autoexec.org >NUL
rem FTPUSERS
if exist \ham\nos\ftpusers.org erase \ham\nos\ftpusers.org >NUL
if exist \ham\nos\ftpusers ren \ham\nos\ftpusers ftpusers.org >NUL
rem ALIAS
if exist \ham\nos\alias.org erase \ham\nos\alias.org >NUL
if exist \ham\nos\alias ren \ham\nos\alias alias.org >NUL
rem NET.RC
if exist \ham\nos\net.org erase \ham\nos\net.org >NUL
if exist \ham\nos\net.rc ren \ham\nos\net.rc net.org >NUL
rem *.SIG - Can't check existance of .org signature - no way to match *.org
ren \ham\nos\*.sig *.org >NUL
rem SIGNATUR\*.SIG - Can't check for existance of .org signature in 
rem                  \SPOOL\SIGNATUR -- so erase all .org's there
erase \ham\nos\spool\signatur\*.org >NUL
ren \ham\nos\spool\signatur\*. *.org >NUL
rem SEQUENCE.SEQ
if exist \ham\nos\spool\sequence.org erase \ham\nos\spool\sequence.org >NUL
if exist \ham\nos\spool\mqueue\sequence.seq copy \ham\nos\spool\mqueue\sequence.seq \ham\nos\spool\sequence.org >NUL
rem HISTORY
if exist \ham\nos\spool\history.org erase \ham\nos\spool\history.org >NUL
if exist \ham\nos\spool\news\history copy \ham\nos\spool\news\history \ham\nos\spool\history.org >NUL
rem NNTP.DAT
if exist \ham\nos\spool\nntp.org erase \ham\nos\spool\nntp.org >NUL
if exist \ham\nos\spool\news\nntp.dat copy \ham\nos\spool\news\nntp.dat \ham\nos\spool\nntp.org >NUL
echo.
echo If OK to continue, press any key. Otherwise press CTRL-C to Abort.
echo.
pause

:extract
cls
echo Extracting JNOS to your %2 Drive.  Please Stand by...
%1:jnos_pkg -d -o
if errorlevel 255 goto user
if errorlevel 50 goto full
if errorlevel 8 goto mem
if errorlevel 7 goto mem
if errorlevel 6 goto mem
if errorlevel 5 goto mem
if errorlevel 4 goto mem
if errorlevel 3 goto error
if errorlevel 2 goto error
if errorlevel 1 goto crc
if errorlevel 0 goto continue
echo.
echo An UNKNOWN Error has occured during the extraction process !
echo Your installation is *NOT* Setup correctly, and WON'T FUNCTION properly ! 
echo.
echo Please correct the problem and Re-Install this Package!
echo.
pause
%1:
goto end
:crc
echo.
echo A CRC Error has occured in one or more of the files extracted !
echo Your installation is *NOT* Setup correctly, and WON'T FUNCTION properly ! 
echo.
echo You could try re-installing, but if this error persists,
echo Please get another copy of this package and try again.
echo.
pause
%1:
goto end 
:mem
echo.
echo Insufficient or Corrupt Memory while extracting files !
echo Your installation is *NOT* Setup correctly, and WON'T FUNCTION properly ! 
echo.
echo Please correct the problem and Re-Install this Package!
echo.
pause
%1:
goto end
:full
echo Insufficient Hard Drive Space!  DRIVE %2 Full!
echo Your installation is *NOT* Setup correctly, and WON'T FUNCTION properly ! 
echo.
echo Package requires 4.5 Meg Free if installing from Hard Drive and
echo at least 3.5 Meg Free if installing from a Floppy Drive
echo.
echo Please correct the problem and Re-Install this Package!
echo.
pause
%1:
goto end
:user
echo This Installation Process has Been INTERUPTED !
echo Your installation is *NOT* Setup correctly, and WON'T FUNCTION properly ! 
echo.
echo Please correct the problem and Re-Install this Package!
echo.
pause
%1:
goto end

:continue
rem Delete Archieve if HD installation
if %1==%2 del %1:\jnos_pkg.exe >NUL

rem Set Selected Drive
copy %2:\ham\nos\setup\dflt_%2.tbl %2:\ham\nos\setup\dflt.tbl >NUL
copy %2:\ham\nos\setup\jnos_%2.pif %2:\ham\jnos.pif >NUL

rem Updates for .TBL files, Autoexec.nos, or Domain.TXT
if exist %1:\*.tbl copy %1:\*.tbl %2:\ham\nos\setup >NUL
if exist %1:\autoexec.nos copy %1:\autoexec.nos %2:\ham\nos >NUL
if exist %1:\domain.txt copy %1:\domain.txt %2:\ham\nos >NUL

cls
echo.
echo.
echo The Main JNOS Program Code has been sucessfully installed.
echo.
echo The Program will now continue with the Installation of the Region Files
echo.
echo Type Control-C to abort, or
pause

rem Region File Extraction
if not exist %2:\ham\nos\setup\region.tbl goto region
rem Region Exists - Could be Re-Install
cls
echo.
echo.
echo The Program has detected existing Region Files. If this is a re-install
echo and you wish to Install New Region Files, the JNOS_RGN.EXE file must
if %1==%2 goto hd1
echo placed in Floppy Drive %1 at this time.
goto prompt
:hd1
echo exist on Hard Drive %1 in the same directory as JNOS_PKG.EXE.
:prompt
echo.
echo If the program fails to find this file, your existing region files
echo will be used. Otherwise, the new REGION files will be loaded now.
echo.
echo Type Control-C to abort, or
pause
if exist %1:\JNOS_RGN.EXE goto extract2
goto contin3

:region
if %1==%2 goto check
echo.
echo.
echo.
echo Please place the Disk containing JNOS_RGN.EXE into floppy drive %1
echo.
echo Type Control-C to abort, or
pause
:check
if exist %1:\JNOS_RGN.EXE goto extract2
echo.
echo.
echo *** Can not find JNOS_RGN.EXE on Drive %1 !!
echo Type Control-C to abort or to try again,
pause
goto region

:extract2
cls
echo.
echo.
echo Extracting JNOS Region Files to your %2 Drive.  Please Stand by...
echo.
%1:jnos_rgn -d -o
if errorlevel 255 goto user
if errorlevel 50 goto full
if errorlevel 8 goto mem
if errorlevel 7 goto mem
if errorlevel 6 goto mem
if errorlevel 5 goto mem
if errorlevel 4 goto mem
if errorlevel 3 goto error
if errorlevel 2 goto error
if errorlevel 1 goto crc
if errorlevel 0 goto contin2
echo.
echo An UNKNOWN Error has occured during the extraction process !
echo Your installation is *NOT* Setup correctly, and WON'T FUNCTION properly ! 
echo.
echo Please correct the problem and Re-Install this Package!
echo.
pause
%1:
goto end

:contin2
cls
echo.
echo.
echo ** Region Files Sucessfully extracted.
echo.
echo.
pause
if %1==%2 del %1:\jnos_rgn.exe >NUL
cd ham
cls
echo.
echo Your JNOS Package is now installed.      
echo.
echo Following are the Customization Instructions needed to configure
echo this copy of JNOS to your personal setting. Please read it carefully.
echo.
echo This file (INTRO.TXT) is located in your %2:\HAM subdirectory
echo Change to that directory and type LIST INTRO.TXT to read this 
echo file from DOS.
echo.
pause
list intro.txt
cls
echo.
echo End of INTRO.TXT  File
echo.
echo The Automatic SETUP Program will now run - 
echo.
echo Note: Package Developers should STOP at this point and read the
echo       Docs located in the \HAM\NOS\SETUP\DOCS.CFG\ Directory for
echo       information on configuration of the program for your own area(s).
echo.
echo Type CONTROL-C to abort to DOS or
pause
call setup
if %1==%2 del %1:\install.bat >NUL
:end
