##############################################################################
#
#     Install script for installing Madge Smart 16/4 Ringnodes
#
#              Copyright (c) 1993-6 Madge Networks Ltd.
#
##############################################################################

##############################################################################
#
#     FILE COPYING DEFINITIONS
#
# The following lines define the location on the release diskettes of the
# files that may be copied.
#
# COPY    = copy from disk1
# COPY2   = copy from disk2
# COPY3   = copy from disk3
#
# ($SOURCE = user selected source directory)
#
##############################################################################

DEFINE $SMART     "COPY3 $SOURCEsmart\smart.exe"
DEFINE $SMARTMOD  "COPY3 $SOURCEsmart"
DEFINE $MADGEODI  "COPY3 $SOURCEnw-dos.odi\madgeodi.com"
DEFINE $DOSODIBIN "COPY3 $SOURCEnw-dos.odi\mdgdos26.bin"
DEFINE $MDGWKST   "COPY3 $SOURCEstnman\workstn.exe"
DEFINE $MDGWKSTDP "COPY3 $SOURCEstnman\dpms.exe"

##############################################################################
#
#     DAT FILE VERSION TRACKING
#
# Version tracking is used so the user can be protected from changes to the 
# INSTALL.EXE program that include changes to Windows or menus referenced by
# the INSTALL.DAT file.
#
# V1.00 Paul Archer    (25/02/93):      INSTALL.EXE v2.00 
# V1.01 Paul Archer    (15/04/93):      INSTALL.EXE v2.01
# V1.02 Iain Betson    (29/06/93):      POCKET INSTALL v2.02, 2.05
# V1.03 Paul Archer    (05/07/93):      INSTALL.EXE v2.03-04, 2.06-08
# V1.04 Martin Dennett (22/12/93):      INSTALL.EXE v2.09
# V1.05 Martin Dennett (18/12/93):      INSTALL.EXE v2.10
# V1.06 Martin Dennett (26/01/94):      INSTALL.EXE v2.11
# V1.07 Martin Dennett (26/01/94):      INSTALL.EXE v2.12
# V1.08 Martin Dennett (16/02/94):      INSTALL.EXE v2.13
# V1.09 Martin Dennett (22/02/94):      INSTALL.EXE v2.14
# V1.10 Paul Archer    (28/04/94):      INSTALL.EXE v2.15 - Smart 16
# V1.11 Martin Dennett (04/05/94):      PCMCIA INSTALL v2.16
# V1.12 Paul Archer    (17/06/94):      Station management re-instated
# V1.13 Paul Archer    (05/11/94):      PCI INSTALL v2.17
# V1.14 Paul Archer    (16/11/94):      PCI INSTALL v2.18 (no WS Agent)
# V1.15 Paul Archer    (01/12/94):      INSTALL.EXE v2.19
# V1.16 Paul Archer    (02/12/94):      INSTALL.EXE v2.20
# V1.17 Paul Archer    (02/03/95):      INSTALL.EXE v2.21 (rel 4.3)
# V1.18 Paul Archer    (27/04/95):      INSTALL.EXE v2.22 (rel 4.3.1)
#
##############################################################################

VERSION 1 18

##############################################################################
#
#     MISCELLANEOUS DEFINITIONS
#
##############################################################################

DEFINE $reading_length "650"

# cleanup1, 2 and 3 are performed on autoexec.bat and config.sys.
# This split is due to a maximum line length of 160 chars.

DEFINE $cleanup1 "REMOVE *netbios*; REMOVE *smart.exe*; REMOVE *lsl*;\
		  REMOVE *ipx*; REMOVE *netx*; REMOVE *vlm*;\
		  REMOVE *net3*; REMOVE *net4*; REMOVE *net5*"

DEFINE $cleanup2 "REMOVE *route*; REMOVE *token*; REMOVE *workstn*;\
		  REMOVE *mintarb*; REMOVE *mtokring*; REMOVE *smartnd*;\
		  REMOVE *DXM??MOD*; REMOVE *smartlsp*"

DEFINE $cleanup3 "REMOVE *tcpip*; REMOVE *netbind*;\
		  REMOVE *odinsup*; REMOVE *lansup*"

DEFINE $cleanup4 "IF ($old_ipx AND NetFunc[Workstation] AND (Nos_ws[NetWare]\
		  OR Nos_ws[NovTCPIP])); ELSE; REMOVE *login*; ENDIF"

DEFINE $cleanup5 "IF $old_ndis;ELSE;REMOVE *protman*;ENDIF"

DEFINE $cleanup6 "REMOVE *madge*"

DEFINE $smart.exe "INSERT '$BOOTsmart.exe path=$BOOT';\
		   $SMART $DEST"

DEFINE $madgeodi.com "$MADGEODI $DEST; $DOSODIBIN $DEST"

DEFINE $stat_man "APPEND_SM '$BOOTworkstn'\
		  $MDGWKST $DEST\
		  $MDGWKSTDP $DEST"

DEFINE $strip   "IF Expert[LLC] OR Expert[NETB]; DIALOG Strip; ELSE;\
		 DEFINE $IBMLLCPARMS '#'; DEFINE $IBMNETBPARMS '#'; ENDIF"

# Symbols re-defined by the TCPIP Module (if used)

DEFINE_PERMANENT $NOVAPI_PATH_TCP_CFG "#"
DEFINE_PERMANENT $TCPIP_IP_ADDRESS "#"
DEFINE_PERMANENT $TCPIP_IP_ROUTER "#"
DEFINE_PERMANENT $TCPIP_IP_NETMASK "#"
DEFINE_PERMANENT $TCPIP_RAW_SOCKETS "#"
DEFINE_PERMANENT $TCPIP_UDP_SOCKETS "#"
DEFINE_PERMANENT $TCPIP_TCP_SOCKETS "#"
DEFINE_PERMANENT $RARP_ETHERS "#"

# Symbols re-defined by the NWWKST Module (if used)

DEFINE_PERMANENT $netx_com_suffix ""

# Symbols used as flags which require initialisation

DEFINE_PERMANENT $Obtained_TCPIP_Details "FALSE"
DEFINE_PERMANENT $written_t_r_snap "FALSE"

# Symbols used but not defined in "Expert" mode

DEFINE $old_ipx2 "FALSE"

##############################################################################
#
# In expert mode we just display the final summary screen. If the user exits
# this screen with OK, then we display the directories screen. Otherwise, we
# go through the normal path.
#
##############################################################################

IF Expert[ExpertOption]
  DIALOG Expert                 ## Straight to the Summary Window
ENDIF

IF Expert[ExpertDone]
  DIALOG Directories            ## Source/Dest directory selection
  DIALOG Dos6                   ## Bring up this screen if config.sys has menu
  $strip
ELSE

##############################################################################
#
# This is the non-expert procedure, taking the user through the full
# interactive path.
#
# First, find out the Ringnode, the network function, the OS and the NOS.
#
##############################################################################

  DIALOG Welcome                        ## The base window

 IF Expert[ExpertOption]
   DIALOG Expert                        ## Straight to the Summary Window
 ENDIF

 IF Expert[ExpertDone]
   DIALOG Directories           ## Source/Dest directory selection
   DIALOG Dos6                  ## Bring up this screen if config.sys has menu
   $strip
 ELSE

  DIALOG Ringnode                       ## The Ringnode window

 IF Ringnode[MC16_128] OR Ringnode[MC16_256] OR Ringnode[MC32]
   DIALOG ADF                           ## A config warning ringnode
 ELSEIF Ringnode[EISA_256]
   DIALOG EISA                          ## Another config warning window
 ELSEIF Ringnode[SMT16_128]
   DIALOG smart16                       ## Another config warning window
 ENDIF

  DIALOG NetFunc                        ## Choose the network function

 IF NetFunc[Server]
  IF Ringnode[PC16]
    DIALOG No_pcserver                  ## No support Servers on PC Ringnodes
    STOP
  ENDIF
   DIALOG Nos_sv                        ## Choose Network OS for Servers
 ELSEIF NetFunc[Workstation]
   DIALOG Nos_ws                        ## Choose Network OS for Workstations

   ## If an option including TCP/IP has been selected then check it is
   ## the Novell API which is required. Sysvars[Novell_API] is set or cleared
   ## by the tcpip_wn dialog accordingly. 

   IF Nos_ws[TCP_IP] OR Nos_ws[NovTCPIP]

     IF Nos_ws[OS2]
       INFO "install\os2inst.inf"
       INFO "lanman2.inf"
       DIALOG No_install
       INSTALL
       DIALOG End
       END
     ENDIF

     IF Nos_ws[NovTCPIP]                ## Select the text used in the dialog 
       SET Sysvars[Second_F5_Text]
     ELSE
       CLEAR Sysvars[Second_F5_Text]
     ENDIF     

     DIALOG TCPIP_WN

     IF Sysvars[Novell_API]             ## If a non-Novell API is required,
     ELSE                               ## provide a .inf file and stop
       INFO "install\tcpip.inf"         ## immediately if Netware not chosen.
       IF Nos_ws[TCP_IP]
	 INSTALL
	 DIALOG End
	 END
       ENDIF
     ENDIF
   ENDIF

 ELSE
   DIALOG Nos_pp                        ## Choose Network OS for Peer-to-peer
 ENDIF

##############################################################################
# Make sure that at this point all the protocol variables are correct and that
# the NetWare workstation defaults are set.
##############################################################################

 CLEAR Sysvars[Smt_NetB]
 CLEAR Sysvars[Smt_LLC]
 CLEAR Sysvars[Smt_IPX]
 CLEAR Sysvars[Smt_ODI]
 CLEAR Sysvars[Smt_TCPIP]

 SET NWwkst[ipx]
 SET NWwkst[SR_Yes]
 SET NWwkst[No_Netbios]

##############################################################################
#
# For NT and UNIX we add the INFO here but allow processing to continue
# because the user might also want INFO about a NOS being used in conjunction
# (e.g. NetWare or LanManager)
#
##############################################################################

 IF (NetFunc[Workstation] AND Nos_ws[UNIX])
   INFO "install\unix.inf"
 ENDIF
 
 IF (NetFunc[Workstation] AND Nos_ws[NT])
   INFO "winnt.inf"
 ENDIF

##############################################################################
#
# Deal with each NOS separately.
#
##############################################################################
    
##############################################################################
# LLC workstation only (survives)

 IF (NetFunc[Workstation] AND Nos_ws[LLC])
  IF Nos_ws[OS2]
    INFO "install\os2inst.inf"
    DIALOG No_install
    INSTALL
    DIALOG End
    END
  ELSE
    INFO "install\otherllc.inf"
    SET Sysvars[Smt_LLC]
  ENDIF
 ENDIF

##############################################################################
# Lantastic - peer-to-peer only, survives

 IF (NetFunc[PeerToPeer] AND Nos_pp[Lantastic])
   INFO "lantasti.inf"
   SET Sysvars[Smt_NetB]
 ENDIF

##############################################################################
# Other Netbios - server and DOS workstation survive

 IF (NetFunc[Workstation] AND Nos_ws[Other_Netbios])
  IF Nos_ws[OS2]
    INFO "install\os2inst.inf"
    DIALOG No_install
    INSTALL 
    DIALOG End
    END
  ELSE
    INFO "install\othernb.inf"
    SET Sysvars[Smt_NetB]
  ENDIF
 ENDIF

##############################################################################
# NetWare (Only DOS workstation survives)

 IF (NetFunc[Server] AND Nos_sv[NetWare])
   INFO "nware4xx.inf"
   INFO "nware3xx.inf"
   INFO "nware2xx.inf"
   DIALOG No_install
   INSTALL
   DIALOG End
   END
 ELSEIF (NetFunc[Workstation] AND (Nos_ws[NetWare] OR Nos_ws[NovTCPIP]))
  IF Nos_ws[OS2]
    INFO "os2-odi.inf"
    DIALOG No_install
    INSTALL 
    DIALOG End
    END
  ENDIF
 ENDIF

##############################################################################
# For Netware workstation/peer to peer, find out if netx or vlm required.

 IF (NetFunc[Workstation] AND (Nos_ws[NetWare] OR Nos_ws[NovTCPIP]) OR (NetFunc[PeerToPeer] AND Nos_pp[NetWareLite]))
   DIALOG NW_rel
 ENDIF


##############################################################################
# MS Lan Manager (Server terminates)

 IF NetFunc[Server] AND Nos_sv[MS_LAN_MAN]
   INFO "lanman2.inf"
   DIALOG No_install
   INSTALL 
   DIALOG End
   END
 ENDIF

 IF NetFunc[Workstation] AND Nos_ws[MS_LAN_MAN]
   SET Sysvars[Smt_NDIS]
   INFO "lanman2.inf"
 ENDIF

##############################################################################
# IBM LAN Server (Only DOS workstation survives (NT and UNIX stopped later))

 # Server with ibm_lan_srv runs over os/2    
 IF NetFunc[Server] AND Nos_sv[IBM_LAN_SRV]
   INFO "install\os2inst.inf"
   DIALOG No_install
   INSTALL 
   DIALOG End
   END
 ENDIF

 IF NetFunc[Workstation] AND Nos_ws[IBM_LAN_SRV]
  IF Nos_ws[Dos]
    SET Sysvars[Smt_NDIS]
    INFO "os2v13.inf"
  ELSEIF Nos_ws[OS2]
    INFO "install\os2inst.inf"
    DIALOG No_install
    INSTALL 
    DIALOG End
    END
  ELSE # NT or UNIX
    INFO "os2v13.inf"
  ENDIF
 ENDIF
		
##############################################################################
# Banyan Vines  - None survive because Vines works best with NDIS driver

 IF (NetFunc[Server] AND Nos_sv[Vines]) OR (NetFunc[Workstation] AND Nos_ws[Vines])
  IF NetFunc[Server]
    INFO "install\vinessrv.inf"
    IF Ringnode[AT16_128] OR Ringnode[AT16_256] OR Ringnode[EISA_256]
      DIALOG No_install
    ELSE
      DIALOG No_servervn
    ENDIF
    INSTALL
    DIALOG End
    END
  ELSEIF Nos_ws[OS2]
    INFO "install\os2inst.inf"
    INFO "install\vinesos2.inf"
    DIALOG No_install
    INSTALL
    DIALOG End
    END
  ELSE
    INFO "install\vinesdos.inf"
    DIALOG No_install
    INSTALL
    DIALOG End
    END
  ENDIF
 ENDIF


##############################################################################
# Windows NT, UNIX and Windows For Workgroups (terminate)

 IF (NetFunc[Workstation] AND (Nos_ws[NT] OR Nos_ws[NativeNT] OR Nos_ws[UNIX] OR Nos_ws[NativeUNIX]))
   IF (Nos_ws[NativeUNIX])
     INFO "install\unix.inf"
   ENDIF
   IF (Nos_ws[NativeNT])
     INFO "winnt.inf"
   ENDIF
   DIALOG No_install
   INSTALL
   DIALOG End
   END
 ENDIF

 IF (NetFunc[PeerToPeer] AND Nos_pp[NT])
   INFO "winnt.inf"
   DIALOG No_install
   INSTALL
   DIALOG End
   END
 ENDIF

IF (NetFunc[PeerToPeer] AND Nos_pp[UNIX]) OR (NetFunc[Server] AND Nos_sv[UNIX])
  INFO "install\unix.inf"
  DIALOG No_install
  INSTALL
  DIALOG End
  END
ENDIF

 IF (NetFunc[PeerToPeer] AND Nos_pp[WinWrkGroup])
   INFO "install\winwkgrp.inf"
   DIALOG No_install
   INSTALL
   DIALOG End
   END
 ENDIF

##############################################################################
#
# Surviving threads are DOS workstations or DOS/NetBios-based servers
# Find out the source and destination directories and which special apps they
# will be using.
#
##############################################################################

  DIALOG Directories            ## Select Source/Dest directories
  DIALOG Dos6                   ## Bring up this screen if config.sys has menu

  IF NetFunc[Workstation] AND (Nos_ws[MS_LAN_MAN] OR Nos_ws[IBM_LAN_SRV])
    DIALOG LanManOrSrv
  ENDIF

  DIALOG specapp1               ## Memory managers/Windows
  DIALOG specapp2               ## LLC applications

##############################################################################
# TCP/IP - Display our new screen to get user options
##############################################################################

 IF (NetFunc[Workstation] AND (Nos_ws[TCP_IP] OR (Nos_ws[NovTCPIP] AND Sysvars[Novell_API])))
   INFO "install\tcpip.inf"
   DIALOG Use_Netcfg
   IF Sysvars[Use_Net_Cfg]
   ELSE
     DIALOG TCPIP
   ENDIF
   SET Sysvars[Smt_TCPIP]
   DEFINE_PERMANENT $Obtained_TCPIP_Details "TRUE"
 ENDIF

##############################################################################
#
# Display the NetWare DOS workstation screens.
# First make sure all the defaults are correct.
#
##############################################################################

 IF (NetFunc[Workstation] AND (Nos_ws[NetWare] OR Nos_ws[NovTCPIP]) OR (NetFunc[PeerToPeer] AND Nos_pp[NetWareLite]))

   DIALOG NWwkst                ## NetWare-ish options window

   SET Sysvars[Smt_IPX]
   DEFINE $old_ipx2 "TRUE"

   IF NWwkst[No_Netbios]        ## Clear or set NetBios bit
     CLEAR Sysvars[Smt_NetB]
   ELSE
     SET Sysvars[Smt_NetB]
   ENDIF

   IF NWwkst[odi]               ## Clear or set ODI bit
     SET Sysvars[Smt_ODI]
   ELSE
     CLEAR Sysvars[Smt_ODI]
   ENDIF
 ELSE
   DEFINE $old_ipx2 "FALSE"
 ENDIF


##############################################################################
#
# Ask about the New Madge Station management program
#
##############################################################################

  DIALOG StatMan

  IF StatMan[Local] OR Statman[Network]
    DIALOG SM_Opts
    SET Sysvars[Smt_IPX]
  ELSE
   IF $old_ipx2
   ELSE
    CLEAR Sysvars[Smt_IPX]
   ENDIF
  ENDIF

##############################################################################
#
# Now the Expert dialog this allows the user to change any option.
# Sysvars[FindAlternative] will be set if the Fastmac button is pressed.
#
##############################################################################

  IF (NetFunc[Workstation] AND (Nos_ws[NetWare] OR Nos_ws[NovTCPIP]))
    SET Sysvars[Netx_Vlm]
  ELSE
    CLEAR Sysvars[Netx_Vlm]
  ENDIF

  DIALOG Expert                 ## The summary window
  $strip                        ## Search for IBM driver parameters

 ENDIF
ENDIF

##############################################################################
#
# All dialogs are complete so start working things out
#
# Decide how much memory is available
#
#node_type "SMT16_128"   = 128 KB
#node_type "PC16"        = 128 KB
#node_type  "ISA_CLIENT" = 128 KB
#node_type "AT16_128"    = 128 KB
#node_type "MC16_128"    = 128 KB
#node_type "AT16_256"    = 256 KB
#node_type "EISA_256"    = 256 KB
#node_type "MC16_256"    = 256 KB
#node_type "MC32"        = 256 KB
#node_type "PCI"         = 512 KB
#node_type "PCI_BM"      = 512 KB
#node_type "AT_P"        = 512 KB
#node_type "PLUGNPLAY"   = 512 KB
#node_type "PCMCIA"      = 512 KB
#
##############################################################################

IF Ringnode[MC16_128] OR Ringnode[SMT16_128] OR Ringnode[AT16_128] OR Ringnode[PC16] OR Ringnode[ISA_CLIENT]
  SET   Sysvars[128K]
  CLEAR Sysvars[256K]
  CLEAR Sysvars[512K]
ELSE
  IF Ringnode[AT16_256] OR Ringnode[MC16_256] OR Ringnode[EISA_256] OR Ringnode[MC32]
    CLEAR Sysvars[128K]
    SET   Sysvars[256K]
    CLEAR Sysvars[512K]
  ELSE
    CLEAR Sysvars[128K]
    CLEAR Sysvars[256K]
    SET   Sysvars[512K]
  ENDIF
ENDIF

##############################################################################
#
# Discover which protocols have been chosen during the expert mode.
# The current list is: IPX, NETB, LLC, ODI, TCPIP, NDIS.
# The expert dialog will have set/cleared Sysvars[Netx_Vlm].
# Convert the Expert selections into Smart selections. These may be cleared
# later if non-smart interfaces are required.
#
##############################################################################

IF Expert[TCPIP]
  INFO "install\tcpip.inf"
  IF $Obtained_TCPIP_Details
    IF Sysvars[FindAlternative]
      DIALOG Lost_TCPIP
    ENDIF
    IF Sysvars[128K]
      IF Expert[LLC] OR Expert[NetB]
	DIALOG Lost_TCPIP
      ENDIF
    ENDIF
  ELSE
    IF Sysvars[FindAlternative]
    ELSE
      IF Sysvars[128K]
	IF Expert[LLC] OR Expert[NetB]
	ELSE
	  DIALOG Use_Netcfg
	  IF Sysvars[Use_Net_Cfg]
	  ELSE
	    DIALOG TCPIP
	  ENDIF
	ENDIF
      ELSE
	DIALOG Use_Netcfg
	IF Sysvars[Use_Net_Cfg]
	ELSE
	  DIALOG TCPIP
	ENDIF
      ENDIF
    ENDIF
  ENDIF
  SET Sysvars[Smt_TCPIP]
ELSE
  CLEAR Sysvars[Smt_TCPIP]
ENDIF

IF Expert[LLC]
  SET Sysvars[Smt_LLC]
ELSE
  CLEAR Sysvars[Smt_LLC]
ENDIF

IF Expert[IPX]
  SET Sysvars[Smt_IPX]
ELSE
  CLEAR Sysvars[Smt_IPX]
ENDIF

IF Expert[ODI]
  INFO "dos-odi.inf"
  SET Sysvars[Smt_ODI]
ELSE
  CLEAR Sysvars[Smt_ODI]
ENDIF

IF Expert[NETB]
  IF NWwkst[Novell_Netbios]
    CLEAR Sysvars[Smt_NetB]
    SET Sysvars[Smt_IPX]
  ELSE
    SET Sysvars[Smt_NetB]
  ENDIF
ELSE
  CLEAR Sysvars[Smt_NetB]
ENDIF

IF Expert[NDIS]
  INFO "smartnd.inf"
  SET Sysvars[Smt_NDIS]
ELSE
  CLEAR Sysvars[Smt_NDIS]
ENDIF

IF Expert[NDIS] OR Expert[NETB] OR Expert[LLC] OR Expert[ODI] OR Expert[IPX] OR Expert[TCPIP]
ELSE
  INSTALL
  DIALOG End
  END
ENDIF

READING $reading_length         ## Start the count-down box

##############################################################################
#
# If Sysvars[FindAlternative] is not set, then use smart.exe
#
##############################################################################

IF Sysvars[Smt_IPX]
  DEFINE $old_ipx "TRUE"
ELSE
  DEFINE $old_ipx "FALSE"
ENDIF

IF Sysvars[Smt_NDIS]
  DEFINE $old_ndis "TRUE"
ELSE
  DEFINE $old_ndis "FALSE"
ENDIF

DEFINE $use_lansup "FALSE"
DEFINE $use_ipxodi "FALSE"
DEFINE $use_odinsup "FALSE"
DEFINE $use_tcpip_exe "FALSE"

DEFINE $0 "FALSE"
DEFINE $1 "FALSE"
DEFINE $2 "FALSE"
DEFINE $3 "FALSE"
DEFINE $4 "FALSE"
DEFINE $5 "FALSE"
DEFINE $6 "FALSE"

IF Sysvars[128K]
  DEFINE $2 "TRUE"
ELSEIF Sysvars[256K]
  DEFINE $4 "TRUE"
ELSEIF Sysvars[512K]
  DEFINE $6 "TRUE"
ENDIF

DEFINE $m1a "IF $3;DEFINE $2 'TRUE';DEFINE $3 'FALSE';\
 ELSEIF $2;DEFINE $1 'TRUE';DEFINE $2 'FALSE';\
 ELSEIF $1;DEFINE $0 'TRUE';DEFINE $1 'FALSE';\
 ENDIF"
DEFINE $m1b "IF $6;DEFINE $5 'TRUE';DEFINE $6 'FALSE';\
 ELSEIF $5;DEFINE $4 'TRUE';DEFINE $5 'FALSE';\
 ELSEIF $4;DEFINE $3 'TRUE';DEFINE $4 'FALSE';\
 ENDIF"

#============================================================================#

IF Sysvars[FindAlternative]

  ###########
  # FASTMAC #
  ###########

  #=- Remaining: IPX, NDIS, TCPIP (ODI implicit, LLC & NetB not allowed)

  CLEAR Sysvars[Smt_ODI]

  IF Sysvars[Smt_TCPIP]
    DEFINE $use_tcpip_exe "TRUE"
    CLEAR Sysvars[Smt_TCPIP]
  ENDIF

  IF Sysvars[Smt_IPX]
    DEFINE $use_ipxodi "TRUE"
    CLEAR Sysvars[Smt_IPX]
  ENDIF

  IF Sysvars[Smt_NDIS]
    DEFINE $use_odinsup "TRUE"
    CLEAR Sysvars[Smt_NDIS]
  ENDIF

ELSE #-----------------------------------------------------------------------#

  #########
  # SMART #
  #########

  #=- Must use NetB and LLC

  IF Sysvars[Smt_NetB]
    $m1a
    $m1b
  ENDIF

  IF Sysvars[Smt_LLC]
    $m1a
    $m1b
  ENDIF

  #=- Remaining: IPX, NDIS, TCPIP, ODI
  #=- TCPIP: If 128K and nothing else yet and nothing else wanted, use TCPIP
  #=-        Else 128K => use tcpip.exe
  #=-        Else 256K/512K Use TCPIP always (counts as 3 protocols)

  IF Sysvars[Smt_TCPIP]
    IF Sysvars[128K]
      IF ($0 OR $1) OR Sysvars[Smt_IPX] OR Sysvars[Smt_NDIS] OR Sysvars[Smt_TCPIP] OR Sysvars[Smt_ODI]
	DEFINE $use_tcpip_exe "TRUE"
	CLEAR Sysvars[Smt_TCPIP]
	SET Sysvars[Smt_ODI]
      ELSE
	$m1a
	$m1b
	$m1a
	$m1b
	$m1a
	$m1b
      ENDIF
    ELSE # 256 or 512K
      $m1a
      $m1b
      $m1a
      $m1b
      $m1a
      $m1b
    ENDIF
  ENDIF

  #=- If 256K & TCPIP & NetB & Need others then use LLC

  IF Sysvars[256K] AND Sysvars[Smt_TCPIP] AND Sysvars[Smt_NetB]
    IF Sysvars[Smt_ODI] OR Sysvars[Smt_NDIS] OR Sysvars[Smt_IPX]
      SET Sysvars[Smt_LLC]
    ENDIF
  ENDIF

  #=- At this point, if $0 then LLC must be in use (whatever ram size)

  #=- If ($0 and IPX or NDIS) OR ($1 and both IPX and NDIS) then will need
  #=- ODI so make sure it is on.

  IF ($0 AND (Sysvars[Smt_IPX] OR Sysvars[Smt_NDIS])) OR ($1 AND (Sysvars[Smt_IPX] AND Sysvars[Smt_NDIS]))
    SET Sysvars[Smt_ODI]
  ENDIF

  #=- Remaining: IPX, NDIS, ODI
  #=- If ODI:
  #=-   If any space remains OR (256K and TCPIP and LLC and not NetB) then use
  #=-   ODI else use lansup

  IF Sysvars[Smt_ODI]
    IF $0
      IF Sysvars[256k] AND Sysvars[Smt_TCPIP] AND Sysvars[Smt_LLC]
	IF Sysvars[Smt_NetB]
	  DEFINE $use_lansup "TRUE"
	  CLEAR Sysvars[Smt_ODI]
	ELSE
	  $m1a
	  $m1b
	ENDIF
      ELSE
	DEFINE $use_lansup "TRUE"
	CLEAR Sysvars[Smt_ODI]
      ENDIF
    ELSE
      $m1a
      $m1b
    ENDIF
  ENDIF

  #=- Remaining: IPX, NDIS
  #=- If IPX:
  #=-   If NDIS and only one space then use ODI
  #=-   If any space then use IPX else use IPXODI

  IF Sysvars[Smt_IPX]
    IF $0
      DEFINE $use_ipxodi "TRUE"
      CLEAR Sysvars[Smt_IPX]
    ELSE
      $m1a
      $m1b
    ENDIF
  ENDIF

  #=- Remaining: NDIS
  #=- If NDIS:
  #=-   If any space then use NDIS else use ODINSUP

  IF Sysvars[Smt_NDIS]
    IF $0
      DEFINE $use_odinsup "TRUE"
      CLEAR Sysvars[Smt_NDIS]
    ELSE
      $m1a
      $m1b
    ENDIF
  ENDIF

#============================================================================#

ENDIF

##############################################################################
#
# Open the autoexec.bat file; clear out all old drivers and IBM drivers;
# and then put in place those drivers which are needed.
#
# The possible entries that we might want to put in this are:
#
# N = Novell Inc program 
#
# For NetBIOS:  SMART.EXE(NETB) or NETBIOS.EXE(N)
#
# For LLC:      SMART.EXE(LLC)
#
# For ODI:      ( LSL.COM(N) and SMART.EXE(ODI) )
#               or ( LSL.COM (N) and MADGEODI.COM and ROUTE.COM(N) )
#               or ( LSL.COM (N) and SMART.EXE(LLC) and LANSUP.COM(N) )
#
# For IPX:      SMART.EXE(IPX) or ( ODI and IPXODI.COM(N) ) or IPX.COM
#
# For NetWare:  NETX.COM/EXE (N)
#
##############################################################################

CLEAR Sysvars[Smart_SR]

DEFINE $odi.sr "IF NWwkst[SR_Yes]; SET Sysvars[Smart_SR]; ENDIF"

DEFINE $lsl.com "INSERT $BOOTlsl.com; USER_COPY lsl.com $DEST"
DEFINE $lansup.com "INSERT $BOOTlansup.com; USER_COPY lansup.com $DEST"
DEFINE $ipxodi.com "INSERT $BOOTipxodi.com; USER_COPY ipxodi.com $DEST"

DEFINE $odinsup.com "INSERT $BOOTodinsup.com; USER_COPY odinsup.com $DEST"
DEFINE $route.com "IF NWwkst[SR_Yes]; INSERT $BOOTroute.com;\
		   USER_COPY route.com $DEST; ENDIF"
DEFINE $tcpip.exe "INSERT $BOOTtcpip.exe; USER_COPY tcpip.exe $DEST"

#-----------------------------------------------------------------------------

OPEN \autoexec.bat
DEFINE_IF_CALLED $lanwp_bat lanwp.bat
DEFINE_IF_CALLED $startnet_bat startnet.bat
$cleanup1
$cleanup2
$cleanup3
$cleanup4
$cleanup5
$cleanup6

#-----------------------------------------------------------------------------
#
# Open any LANWP.BAT and STARTNET.BAT batch files which are called from
# autoexec.bat and remove unwanted drivers.
#
#-----------------------------------------------------------------------------

IFDEF $startnet_bat
  OPEN $startnet_bat
  $cleanup1
  $cleanup2
  $cleanup3
  $cleanup4
  $cleanup5
  $cleanup6
ENDIF

IFDEF $lanwp_bat
  OPEN $lanwp_bat
  $cleanup1
  $cleanup2
  $cleanup3                             # Prefered insertion points in 
  $cleanup4                             # descending order of preference:
  $cleanup5
  $cleanup6
  FIND *path*                           # 1: Insert after a PATH command
  IF Sysvars[FOUND]
  ELSE
    FIND *yesno*                        # 2: Insert after a line with YESNO
    IF Sysvars[FOUND]
    ELSE
      FIND *login*                      # 3: Insert before a LOGIN command
      IF Sysvars[FOUND]
	UP
      ELSE
	OPEN \autoexec.bat              # else return to the autoexec.bat file
	BOT                             # ... and move to the end
      ENDIF
    ENDIF
  ENDIF
ELSE
  IF ($old_ipx AND NetFunc[Workstation] AND (Nos_ws[NetWare] OR Nos_ws[NovTCPIP]))
    OPEN \autoexec.bat                  # return to the autoexec.bat file
    TOP                                 # ... ensure searching from top
    FIND *login*
    IF Sysvars[FOUND]
      FIND_PREVIOUS =?:
      UP
    ELSE
      BOT                                       # ... and move to the end
    ENDIF
  ELSE
    BOT
  ENDIF
ENDIF

#------------------------------------
# Order to use:
#
#   lsl.com     (if ODI in use) |  lsl.com
#   SMART.EXE                   |  madgeodi.com
#   lansup.com  (llc -> odi)
#   route.com   (use if lansup used)
#   ipxodi.com  (odi -> ipx)
#   tcpip.exe   (odi -> tcpip)
#   odinsup.com (odi -> ndis)
#   netx.com/exe vlm.exe
#   netbios.exe (odi -> Novell netb)
#   netbind.exe (if NDIS, may be commented out)
#
#------------------------------------

IF Sysvars[Smt_ODI] OR $use_lansup OR Sysvars[FindAlternative]
  $lsl.com
ENDIF

IF Sysvars[FindAlternative]

  IF Ringnode[SMT16_128]
    IF smart16[int_3]
      INSERT "$BOOTmadgeodi.com irq=3"
    ELSEIF smart16[int_2]
      INSERT "$BOOTmadgeodi.com irq=2"
    ELSE
      INSERT "$BOOTmadgeodi.com irq=7"
    ENDIF
  ELSE
    INSERT "$BOOTmadgeodi.com"
  ENDIF
  $madgeodi.com
  $route.com

ELSE

  $smart.exe
  IF $use_lansup
    $lansup.com
    $route.com
  ENDIF

ENDIF

IF $use_ipxodi
  $ipxodi.com
ENDIF

#---- If smart ODI is being used check if need odi.sr
IF Sysvars[Smt_ODI]
  $odi.sr
ENDIF

IF $use_tcpip_exe
  $tcpip.exe
ENDIF

IF $use_odinsup
  $odinsup.com
ENDIF

IF Expert[IPX]
  IF Sysvars[Netx_Vlm]

    IF NW_rel[NW_netx]
      INSERT "$BOOTnetx$netx_com_suffix"
      USER_COPY netx.com/exe $DEST
    ELSE
      INSERT "$BOOTvlm$netx_com_suffix"
      USER_COPY vlm.exe $DEST
    ENDIF

  ENDIF
ENDIF

IF Expert[NetB] AND NWwkst[Novell_Netbios]
  INSERT $BOOTnetbios.exe
ENDIF

IF $old_ndis
  IF NetFunc[Workstation] AND (Nos_ws[MS_LAN_MAN] OR Nos_ws[IBM_LAN_SRV]) AND Sysvars[Found_Smartnd]
    INSERT "$BOOTnetbind.exe"
  ELSE
    INSERT "REM -- Put NDIS protocol drivers before this line, or in CONFIG.SYS."
    INSERT "REM -- Then remove the 'REM ' from the start of the following line:"
    INSERT "REM $BOOTnetbind.exe"
  ENDIF
ENDIF

##############################################################################
#
# Put the Madge Station Management at the end of the AUTOEXEC.BAT file.
#
##############################################################################

IF StatMan[Local]
  INFO "workstn.inf"
  $stat_man
ELSEIF Statman[Network]
  INFO "workstn.inf"
  INSERT "SET MWSM_NAME=$MWSM_NAME"
  INSERT "SET MWSM_DESC=$MWSM_DESC"
  INSERT "SET MWSM_CONT=$MWSM_CONT"
  INSERT "SET MWSM_LOC=$MWSM_LOC"
ENDIF

##############################################################################
#
# If NDIS required then make the changes to protocol.ini
#
##############################################################################

IF $old_ndis
  DIALOG Protocol_ini
ENDIF

##############################################################################
#
# Open the CONFIG.SYS and remove unwanted drivers
#
##############################################################################

OPEN \config.sys
$cleanup1
$cleanup2
$cleanup3
$cleanup5

IF NW_rel[NW_vlm]
  REMOVE "=lastdrive=\=?="
  TOP
  INSERT "lastdrive=z"
ENDIF

IF $old_ndis   # Avoid removing '*madge*' if want to keep old protman.dos's
ELSE
  $cleanup6
ENDIF

IF $old_ndis AND Sysvars[Need_Protman]
  INSERT "DEVICE=$BOOTprotman.dos"
ENDIF

##############################################################################
#
# Open the SMART.CFG and fill it with the required values
# (...but only if using some smart protocols)
#
##############################################################################

IF Sysvars[Smt_IPX] OR Sysvars[Smt_NetB] OR Sysvars[Smt_LLC] OR Sysvars[Smt_ODI] OR Sysvars[Smt_TCPIP] OR Sysvars[Smt_NDIS]

  OPEN $BOOTsmart.cfg
  REMOVE *

  INFO "smart.inf"
  INFO "host.inf"
  INFO "card.inf"

  APPEND [host]

  IF specapp1[BM_Yes] OR specapp1[BM_Maybe]
    APPEND ^^high
  ENDIF

  IF specapp1[Win_30]
    APPEND ^^win=30
  ELSEIF specapp1[Win_31]
    APPEND ^^win=31
  ENDIF

  IF specapp2[3270_100]
    INFO "install\pc3270.inf"
    APPEND ^^pc3270=100
  ELSEIF specapp2[3270_101]
    APPEND ^^pc3270=101
  ENDIF

  APPEND ^^[card]

  IF specapp1[BM_Yes] OR specapp1[BM_Maybe]
    IF Ringnode[MC32] OR Ringnode[EISA_256] OR Ringnode[MC16_128] OR Ringnode[PCI_BM]
      APPEND ^^^^lomem
    ELSE
      APPEND ^^^^pio
    ENDIF
  ENDIF

  IF Ringnode[SMT16_128]
    IF smart16[int_3]
      APPEND ^^^^irq=3
    ELSEIF smart16[int_2]
      APPEND ^^^^irq=2
    ELSE
      APPEND ^^^^irq=7
    ENDIF
    IF smart16[AltMode]
      APPEND ^^^^alternate
    ENDIF
  ENDIF


#  //////////////////////////////////////////////////////////////////////  #

  IF Sysvars[Smt_IPX]
    INFO "ipx.inf"
    $SMARTMOD\ipx.smt $DEST
    APPEND ^^^^[ipx]
    IF NWwkst[SR_Yes]
      APPEND ^^^^^^sr=y
    ENDIF
  ENDIF

  IF Sysvars[Smt_NDIS]
    INFO "ndis.inf"
    $SMARTMOD\ndis.smt $DEST
    APPEND ^^^^[ndis]
  ENDIF

  IF Sysvars[Smt_NetB]
    INFO "netb.inf"
    $SMARTMOD\netb.smt $DEST
    APPEND ^^^^[netb]
    $IBMNETBPARMS                       ## The parameters from the IBM driver
  ENDIF

  IF Sysvars[Smt_LLC]
    INFO "llc.inf"
    $SMARTMOD\llc.smt $DEST
    APPEND ^^^^[llc]
    $IBMLLCPARMS                        ## The parameters from the IBM driver

    IF specapp2[LLC_Yes_AS_400]
      APPEND ^^^^^^pcs
    ENDIF

  ENDIF

  IF Sysvars[Smt_ODI]
    INFO "odi.inf"
    $SMARTMOD\odi.smt $DEST
    APPEND ^^^^[odi]
    APPEND "^^^^^^FRAME TOKEN-RING"
    DEFINE_PERMANENT $written_t_r_snap "FALSE"
    IF Expert[TCPIP]
      IF Sysvars[Smt_TCPIP]
      ELSE
	APPEND "^^^^^^FRAME TOKEN-RING_SNAP"
	DEFINE_PERMANENT $written_t_r_snap "TRUE"
      ENDIF
    ENDIF
    IF $use_odinsup
      IF $written_t_r_snap
      ELSE
	APPEND "^^^^^^FRAME TOKEN-RING_SNAP"
      ENDIF
      APPEND "^^^^^^ODI.NSUP=YES"
    ENDIF
    IF Sysvars[Smart_SR]
      APPEND "^^^^^^odi.sr=yes"
    ENDIF
  ENDIF

  ########## TCPIP ###########

  IF Sysvars[Smt_TCPIP]
    INFO "tcpip.inf"
    INFO "novapi.inf"
    IF TCPIP[Provide_Rarp_Yes]
      INFO "rarpd.inf"
    ENDIF
    $SMARTMOD\ip.smt $DEST
    $SMARTMOD\udp.smt $DEST
    $SMARTMOD\tcp.smt $DEST
    $SMARTMOD\novapi.smt $DEST

    IF Sysvars[Use_Net_Cfg]

      APPEND "^^^^[NOVAPI]"
      APPEND "^^^^[IP]"
      APPEND "^^^^[UDP]"
      APPEND "^^^^[TCP]"

    ELSE

      APPEND "^^^^[NOVAPI]"
      $NOVAPI_PATH_TCP_CFG
      IF TCPIP[Statistics_Enable]
	APPEND "^^^^^^enable.statistics=YES"
      ENDIF

      APPEND "^^^^[IP]"
      IF TCPIP[Arp_All_Yes]   ## rely on defaults when 'no' selected
	APPEND "^^^^^^arp.broadcast.all=YES"
      ENDIF
      IF TCPIP[Rarp_All_Yes]
	APPEND "^^^^^^rarp.broadcast.all=YES"
      ENDIF
      IF TCPIP[Sr_Local_Broadcast_Yes]
	APPEND "^^^^^^sr.local.broadcast=YES"
      ENDIF
      IF TCPIP[Statistics_Enable]
	APPEND "^^^^^^enable.mib=YES"
      ENDIF
      $TCPIP_IP_ADDRESS         ## Macros are set up by tcpip.c
      $TCPIP_IP_ROUTER
      $TCPIP_IP_NETMASK
      $TCPIP_RAW_SOCKETS

      APPEND "^^^^[UDP]"
      $TCPIP_UDP_SOCKETS
      IF TCPIP[Provide_Bootp_Yes]
	APPEND "^^^^^^udp.bootp=YES"
      ENDIF

      APPEND "^^^^[TCP]"
      $TCPIP_TCP_SOCKETS
 
      IF TCPIP[Provide_Rarp_Yes]
	$SMARTMOD\rarpd.smt $DEST
	APPEND "^^^^[RARPD]"
	$RARP_ETHERS
      ENDIF

    ENDIF

  ELSE #Smt_TCPIP

    CLOSE *NET.CFG  ## MD (10/1/94) - ensure no changes to net.cfg

  ENDIF #Smt_TCPIP

  IF Sysvars[Smt_NDIS]
    APPEND ^^^^[ndis]
  ENDIF

ENDIF #SMT MODULES

##############################################################################
#
# Finally, Do the Installation
#
##############################################################################

READING 0
INSTALL
DIALOG End
END

##############################################################################
