@echo off
rem -------------------------------------------------------------------------
rem update.bat: installation batch file for Sniffer R4.52
rem usage: update
rem -------------------------------------------------------------------------

cls
echo.
echo ------------------------------------------------------------------------
echo          Update procedure for Sniffer R4.52 software:
echo ------------------------------------------------------------------------
echo.
echo You are about to update Sniffer software onto your hard disk (drive C:)
echo.
echo If you would like to back up any software currently loaded 
echo on your hard disk, do not update the Sniffer software, but 
echo perform the backup before proceeding with the update.
echo.

a:\input "Do you wish to update the Sniffer software now?"
if not errorlevel 1 goto usr_abort

rem check if it is a sniffer
if not exist c:\config\*.* goto err_config
if not exist c:\tools\*.* goto err_config
if not exist c:\tools\fixemm.exe goto err_config
if not exist c:\dos\*.* goto err_config

rem check platform 

if exist a:\pa-10x.cfg set pl=PL-10
if exist a:\pa-10x.cfg goto no_plcheck
if exist a:\pa-11x.cfg set pl=PL-11
if exist a:\pa-11x.cfg goto no_plcheck
if exist a:\pa-20x.cfg set pl=PL-20
if exist a:\pa-20x.cfg goto check_pl
if exist a:\pa-30x.cfg set pl=PL-30
if exist a:\pa-30x.cfg goto check_pl
if exist a:\pa-31x.cfg set pl=PL-30
if exist a:\pa-31x.cfg goto check_pl
if exist a:\pa-3jx.cfg set pl=PL-30
if exist a:\pa-3jx.cfg goto check_pl
if exist a:\pa-3tx.cfg set pl=PL-30
if exist a:\pa-3tx.cfg goto check_pl
if exist a:\pa-3lx.cfg set pl=PL-30
if exist a:\pa-3lx.cfg goto check_pl
if exist a:\pa-35x.cfg set pl=PL-35
if exist a:\pa-35x.cfg goto check_pl
if exist a:\pa-36x.cfg set pl=PL-36
if exist a:\pa-36x.cfg goto check_pl
if exist a:\pa-50x.cfg set pl=PL-50
if exist a:\pa-50x.cfg goto check_pl
if exist a:\pa-51x.cfg set pl=PL-51
if exist a:\pa-51x.cfg goto check_pl
if exist a:\pa-54x.cfg set pl=PL-54
if exist a:\pa-54x.cfg goto check_pl
if exist a:\pa-55x.cfg set pl=PL-55
if exist a:\pa-55x.cfg goto check_pl
if exist a:\pa-56x.cfg set pl=PL-56
if exist a:\pa-56x.cfg goto check_pl
if exist a:\pa-57x.cfg set pl=PL-57
if exist a:\pa-57x.cfg goto check_pl
if exist a:\pa-60x.cfg set pl=PL-60
if exist a:\pa-60x.cfg goto check_pl
if exist a:\pa-70x.cfg set pl=PL-70
if exist a:\pa-70x.cfg goto no_plcheck
if exist a:\pa-76x.cfg set pl=PL-76
if exist a:\pa-76x.cfg goto no_plcheck
if exist a:\pa-80x.cfg set pl=PL-80
if exist a:\pa-80x.cfg goto no_plcheck
goto no_cfg      
                 
:check_pl
a:\chkplat %pl% >NUL
if errorlevel 3 goto wrong_bios
if errorlevel 1 goto wrong_platform

:no_plcheck
rem - save existing config.sys, autoexec.bat; only once though
if exist c:\config.sys goto save_cfg
if exist c:\autoexec.bat goto save_cfg
goto no_windows

:save_cfg
if not exist c:\config.450   if exist c:\config.sys   copy c:\config.sys c:\config.450 > NUL
if not exist c:\autoexec.450 if exist c:\autoexec.bat copy c:\autoexec.bat c:\autoexec.450 > NUL

rem - notify user of saved windows config.sys and autoexec.bat files
echo.
echo The Sniffer software requires new config.sys and autoexec.bat files.
echo Previous versions of these files have thus been saved to the following
echo backup files:
echo.
echo       ORIGINAL: c:\config.sys      SAVED TO: c:\config.450
echo       ORIGINAL: c:\autoexec.bat    SAVED TO: c:\autoexec.450
echo.
pause
:no_windows

rem - chain to the next batch file; needed to bootstrap!
c:
cd \tools
copy a:\upmain.bat > NUL
copy a:pa-*.* >NUL
upmain %pl% update

rem - user terminated installation
:usr_abort
echo.
echo You decided to abort the update at this time.  To load the Sniffer
echo R4.52 software later, restart the update process from the beginning.
echo.
goto exit

:no_cfg
echo.
echo No platform configuration file was found on the diskettes.  Contact 
echo Network General for assistance.
echo.
goto exit

:wrong_bios
echo.
echo You are attempting to update the Sniffer Network Analyzer on a 
echo Dolch 486/66 that does not have the latest BIOS revision. Contact 
echo DOLCH computers in order to upgrade your BIOS.  
echo.
goto exit

rem - invalid Sniffer directory structure
:err_config
echo.
echo You are trying to update a computer that is not a Sniffer.
echo Please call Network General Support if you are experiencing
echo problems installing this software on your authorized Sniffer 
echo R4.xx platform.
echo.
goto exit

rem - wrong platform
:wrong_platform

echo.
echo You are attempting to update the Sniffer Network Analyzer  
echo with diskettes that were intended for a different platform.
echo Contact Network General for assistance.
echo.  
:exit

