@echo off
rem -------------------------------------------------------------------------
rem upsnif.bat: tries to update all Release 4.40 Sniffer software
rem usage: upsnif
rem -------------------------------------------------------------------------
rem
cls
if not exist c:\%actual%sniff\%actual%sniff.exe goto no_topo
set success=0

rem save existing r2host users and and config

if exist c:\remote2\r2host\r2.usr copy c:\remote2\r2host\r2.usr c:\remote2\r2host\r2.sav >NUL
if exist c:\remote2\r2host\r2.key copy c:\remote2\r2host\r2.key c:\remote2\r2host\r2key.sav >NUL

rem - load the Platform software
:retry
cls
echo.
echo Continue with diskette labeled 'Platform Software'...
ngrestor a: c: /TPlatform
if errorlevel 99 goto err_disk
if errorlevel  2 goto err_quit
if errorlevel  1 goto err_load

rem delete extra config.sys and autoexec files
if exist c:\cfg.5  del c:\cfg.5       >NUL
if exist c:\cfgd.6 del c:\cfgd.6      >NUL
if exist c:\cfgw.6 del c:\cfgw.6      >NUL
if exist c:\auto.5c del c:\auto.5c    >NUL
if exist c:\auto.5m del c:\auto.5m    >NUL
if exist c:\auto.6cd del c:\auto.6cd  >NUL
if exist c:\auto.6cw del c:\auto.6cw  >NUL
if exist c:\auto.6md del c:\auto.6md  >NUL
if exist c:\auto.6mw del c:\auto.6mw  >NUL
if exist c:\autoexec.mno del c:\autoexec.mno  >NUL
if exist c:\autoexec.clr del c:\autoexec.clr  >NUL

rem - delete the old versions of remote2
if exist c:\remote2\r2host\chat.com del c:\remote2\r2host\chat.com >nul
if exist c:\remote2\r2host\r2host.com del c:\remote2\r2host\r2host.com >nul

if exist c:\remote2\r2host\r2.sav     copy c:\remote2\r2host\r2.sav c:\remote2\r2host\r2.usr >NUL
if exist c:\remote2\r2host\r2key.sav  copy c:\remote2\r2host\r2key.sav c:\remote2\r2host\r2.key >NUL

if not "%topo%"=="HS" call upload.bat 
if not "%topo%"=="HS" goto doneload 
call upload.bat 

if not "%success%"=="0" goto err_update
set topo=LM
set actual=LM2000
set name=LM2000
set addr=LMSY
call upload.bat 

set topo=HS
set actual=SY
set name=Internetwork
set addr=HSSY

:doneload
if not "%success%"=="0" goto err_update

rem - all done
c:

rem - update menu.txt only if successfully updated
srline 4.4

cls
echo.
echo ------------------------------------------------------------------------
echo      Sniffer R4.4 %name% update processing completed successfully
echo ------------------------------------------------------------------------
echo.
echo     Remove any diskette from the floppy drive and reboot the Sniffer.
echo.
rem - cleaning up after ourself
if exist c:\tools\upload.bat del c:\tools\upload.bat >NUL
if exist c:\snfcfg\*.* deldir \snfcfg /c >NUL

goto exit

rem - ngrestor failure
:err_load
echo.
echo Fatal Error: NGRESTOR failed to load the Sniffer platform software.
echo Please contact Network General Technical Support for assistance.
echo.
echo NGRESTOR failure. Send new diskettes. > c:\update.err
goto exit

rem - nothing to update
:err_void
echo.
echo Your Sniffer software is already up to date.  You do not need to run
echo this batch file at this time.  Please refer to your documentation for
echo instruction on how to update your Sniffer software.
echo.
echo Sniffer already up to date. > c:\update.err
goto exit

rem - failed to insert the correct first diskette
:err_disk
echo.
echo The diskette you inserted is not the Platform Software diskette.
echo.
echo To continue the installation, insert the Platform Software diskette.
echo To abort the installation, answer NO at the next prompt.
echo.

input "Do you wish to continue the installation?"
if errorlevel 1 goto retry

rem - note: we don't exit on purpose, we want the next message!
echo Aborted trying to load the Platform Software diskette > c:\update.err
cls

rem - failed to install analyzer; see c:\update.err file
:err_update
echo.
echo The Sniffer update did not complete due to the previous error.
echo.
echo Please consult your update instructions for suggestions on how 
echo to resolve this problem.  If you require further assistance, please
echo contact Network General Technical Support for assistance.
echo.
goto exit

rem - user quit at ngrestore prompt
:err_quit
echo.
echo You terminated the update process.  If you are experiencing
echo difficulties, please contact Network General Technical Support for 
echo assistance.
echo.
echo User quit at the ngrestor prompt. > c:\update.err
goto exit

rem - terminated before completion
:err_update
echo.
echo You terminated the Sniffer update process before completion.
echo.
echo To later complete the Sniffer update process, execute the following
echo command at the DOS prompt ([ENTER] asks you to hit the 'Enter' key):
echo.
echo    upsnif [ENTER]
echo.
echo The update process will be restarted where you terminated it.
echo If you encounter problems, please contact Network General Technical
echo Support for further assistance.
echo.
echo User terminated the Sniffer update process. > c:\update.err
goto exit

rem - no Sniffer software to update
:no_topo
echo.
echo Only Ethernet, Ethernet-II, Ethernet-III, Token-Ring, Token-Ring-II,
echo Token-Ring-III, FDDI, and Highspeed WAN software was released for 
echo Sniffer R4.4.  The Sniffer software was not updated becuase the 
echo topology that you are trying to update does not exist on this Sniffer.
echo If you have any further questions, please contact Network General 
echo Technical Support.
echo.
goto exit


rem - common exit
:exit

