
$JOB GenInstall

	$PauseOff

	; Nationalizable messages

	DirMsg		= 'Creating socket directories.........'
	InstDoneMsg	= 'Installation is complete, please reboot your system.'
    PMCntnueMsg1 = 'B25TCP4 contains the installation for Protocol Manager.'
	PMCntnueMsg2 = 'To install the fourth disk choose Install New Software'
    PMCntnueMsg3 = 'in the main menu of Installation Manager.'
	MergeMsg	= 'Updating system request file.........'
	MergeMsg2	= 'Please wait, this may take some time.........'
	PtrNameMsg	= 'Enter your printer name and press GO.'
	RifViewMsg	= 'Do you wish to view the Release Notes at this time?'
	RifPrintMsg	= 'Do you wish to print the Release Notes at this time?'
	UnAtndMsg1	= '          Unattended floppy installation is not supported.'
	UnAtndMsg2	= '                  INSTALLATION IS CANCELLED'
	GoMsg		= '                       Press AEGOAA to Continue.'
	UserMsg1	= 'Socket directories are <tcpip.sock> and <tcpip.Csock>.'
	UserMsg2	= 'Socket volume is [sys] for public installation, [sys] otherwise.'
	UserMsg3	= 'FTP client API directory is <TCPIP.FAPI>'
	UserMsg4	= 'FTP client volume is [sys] for public installation, [sys] otherwise.'
	Question1	= 'Select the components to be installed.'
	Choice1		= 'TCP, IP, X.25NGI, SMTP, and FTP servers'
	Choice2		= 'Telnet, FTP Client, and Log reporter'
	Choice3		= 'SocketClusterShare and FTP Client API libraries'
	NoSelec 	= 'No selection was made. Select Yes to see the menu again'
	
	RemCmdMsg1	= 'Removing old Data Link Manager commands.........'
	FloppyFiles	= 'Copying files.........'
	MCF			= 'Merge Command Files'


; Non nationalizable messages


	VidLev		= 0
	Selected	= 0
	ServerSpec	= '[sys]<Installed>'
	SwdDir		= '[Sys]<LcnTCPIP>'

	SwInstal	= 0
	Sd2of3Msg = 'TCP Distribution Disk 2 of 3'
	Sd3of3Msg = 'TCP Distribution Disk 3 of 3'



	$RestartLabel

	$If InstallType = 4; SWD installation
		From_Sys		= SwdDir
		From_CTOS		= SwdDir
		From_Socket		= SwdDir
		From_cSocket	= SwdDir
		From_fAPI		= SwdDir
		SwInstal		= 1
	$Else
		From_Sys		= ConcatStrings(DeviceFrom,'<sys>')
		From_CTOS		= ConcatStrings(DeviceFrom,'<CTOS>')
		From_Socket		= ConcatStrings(DeviceFrom,'<Socket>')
		From_cSocket	= ConcatStrings(DeviceFrom,'<CSocket>')
		From_fAPI		= ConcatStrings(DeviceFrom,'<fAPI>')
	$EndIf

	$If InstallType	= 2; Install from server
		From_Sys		= ServerSpec
		From_CTOS		= ServerSpec
		From_Socket		= ServerSpec
		From_fAPI		= ServerSpec
		From_cSocket	= ServerSpec
	$EndIf

	$If Unattended and InstallType = 0; Floppy installation
		$DisplayLine
		$DisplayLine
		$DisplayLine
		$DisplayLine
		$DisplayLine
		$DisplayLine (UnAtndMsg1)
		$DisplayLine
		$DisplayLine (UnAtndMsg2)
		$DisplayLine (GoMsg)
		$DisplayLine
		$DisplayLine
		$DisplayLine
		$Path,Sys,Sys
		$DisplayAndWait
		$Cancel
	$EndIf


	$If Unattended and InstallType > 0; unattended and not floppy
		Ch1	= 1
		Ch2	= 1
		Ch3	= 1
		SWInstal = 1
	$EndIf

	$If PUBLIC
		CmdFileTo	= '[Sys]<sys>Cluster.cmds'
		Destpath	= '[Sys]<tcpip.sock>'
		Destpath1	= '[Sys]<tcpip.Csock>'
		Destpath2	= '[Sys]<sys>'
		Destpath3	= '[Sys]<TCPIP.FAPI>'
		DefVol		= '[Sys]'
	$Else
		CmdFileTo	= '[Sys]<sys>sys.cmds'
		Destpath	= '[Sys]<tcpip.sock>'
		Destpath1	= '[Sys]<tcpip.Csock>'
		Destpath2	= '[Sys]<sys>'
		Destpath3	= '[Sys]<TCPIP.FAPI>'
		DefVol		= '[Sys]'
	$EndIf



	$If VideoLevel > 0
		VidLev	= 1
	$EndIf

	$If (VideoLevel = 0) and (SWInstal = 0)
		$PAUSEON
	$EndIf; of verbosity

	$If (VideoLevel = 1) 
		$EchoOff
	$EndIf; of videolevel


	$If SWInstal = 0; attended installation
		$RestartLabel

		RifFile	= ConcatStrings(From_Sys,'ReleaseNotes.doc')
		Temp1	= UserSelectYesNo(RifViewMsg)

		$If Temp1
			i = 0
			$While (i < 10)
				i = i + 1
				$DisplayLine
			$EndWhile
			
			$PauseOn
			$EchoOn
			$Command Type, RifFile, no
			$If VidLev > 0
				$EchoOff
				$PauseOff
			$EndIf
		$EndIf

		$DeAssign(RifViewMsg)

		Temp1	= UserSelectYesNo(RifPrintMsg)

		$If Temp1 = 1
			i = 0
			$While (i < 10)
				i = i + 1
				$DisplayLine
			$EndWhile

			PrintName = UserEnterValue(PtrNameMsg)
			P 	= $ConcatStrings('[',PrintName)
			P1	= $ConcatStrings(P,']')
			RifFile = $ConcatStrings(From_Sys,'ReleaseNotes.doc')
			$Command Copy,RifFile,P1
		$EndIf


		$DeAssign(RifPrintMsg)
		$DeAssign(PtrNameMsg)

		;scroll screen

		i = 0;
		$While (i < 20)
			i = i + 1
			$DisplayLine
		$EndWhile

	
		$RestartLabel

		$While (Selected	= 0)
			Quest	= $UserSelectMultiple(Question1, Choice1, Choice2, Choice3)

			Ch1	=SubString(Choice1, Quest)
			Ch2	=SubString(Choice2, Quest)
			Ch3	=SubString(Choice3, Quest)

		; 65535 is the value returned if no string is found
		; this routine tells the user that no selection was made and repeats
		; the menu display

			$If (Ch1 = 65535) and (Ch2 = 65535) and (Ch3 = 65535)
				Temp1 = $UserSelectYesNo (NoSelec, 'Yes')
				$If Temp1
					Selected = 0
				$Else
					Temp1 = 0
					Selected = 1
					DisplayLine (UnatndMsg2)
					DisplayLine
					DisplayLine (GoMsg)
					DisplayLine
					DisplayLine
					DisplayLine
					Path,Sys,Sys
					DisplayAndWait
					Cancel
				$EndIf
			$Else
				Temp1 = 255
				Selected = 1
			$EndIf
		$EndWhile

		$DeAssign(UnatndMsg1)
		$DeAssign(UnatndMsg2)
		$DeAssign(Question1)
		$DeAssign(Choice1)
		$DeAssign(Choice2)
		$DeAssign(Choice3)
		$DeAssign(Temp1)

		$RestartLabel

		$If Ch3 <> 65535; Sockets chosen
	
			$DisplayLine(UserMsg1)
			$DisplayLine(UserMsg2)
			$DisplayLine(UserMsg3)
			$DisplayLine(UserMsg4)

			$DisplayLine
			$DisplayLine
			$DisplayAndWait(GoMsg)

			i = 0;
			$While (i < 10)
				i = i + 1
				$DisplayLine
			$EndWhile

			$Display(DirMsg)
			$Command Create Directory, (Destpath,Destpath1,Destpath3)
	
			$DisplayLine('DONE')
			$DisplayLine
			$DisplayLine
			$DisplayLine
			$DisplayLine
		$EndIf; Sockets chosen

		i = 0;
		$While (i < 10)
			i = i + 1
			$DisplayLine
		$EndWhile

	$EndIf; SWInstal = 0

	$If SWInstal = 1
		$Display(DirMsg)
		$Command Create Directory,(Destpath,Destpath1,Destpath3)
		$DisplayLine('DONE')
	$EndIf

	$Display(FloppyFiles)


	$If Public
		$Run [Sys]<sys>Lcopy.run,(Fdsys.Version,Install.ctrl,Install.jcl), 
			From_Sys, ServerSpec,,yes,,no

		$Run [Sys]<sys>Lcopy.run,(ReleaseNotes.doc,Request.list) , 
			 From_Sys,ServerSpec,,yes,,no

		$Run [Sys]<sys>Lcopy.run,(Request.TCPIP.txt,request.TCPIP.version),
			From_Sys,ServerSpec,,yes,,no

		$Run [Sys]<sys>Lcopy.run,(tcpip1.cmds,TCPIP2.Cmds),From_Sys, 
			ServerSpec,,yes,,no


		$Run [Sys]<sys>Lcopy.run,TCP.Telnet.run,From_ctos,ServerSpec,,yes,,no

		$Run [Sys]<sys>Lcopy.run,TCPIP.Params, From_ctos, ServerSpec,,yes,,no


		$Run [Sys]<sys>Lcopy.run,(echoserver.c,filedesc.h,get_time.c), 
			From_socket,ServerSpec,,yes,,no
		$Run [Sys]<sys>Lcopy.run,(multecho.c,netdb.h,netinetin.h), 
			From_socket,ServerSpec,,yes,,no
		$Run [Sys]<sys>Lcopy.run,(sender_udp.c,sftp.c,socket.lib,socklim.c), 
			From_socket,ServerSpec,,yes,,no
		$Run [Sys]<sys>Lcopy.run,(syssocket.h,systypes.h,terminal_1.c), 
			From_socket,ServerSpec,,yes,,no
		$Run [Sys]<sys>Lcopy.run,(terminal_2.c,terminal_3.c,udp_echo.c), 
			From_socket,ServerSpec,,yes,,no
		$Run [Sys]<sys>Lcopy.run,(arpainet.h,bstring.h,terminal.c), 
			From_socket,ServerSpec,,yes,,no
		$Run [Sys]<sys>Lcopy.run,(syssocompat.h), 
			From_socket,ServerSpec,,yes,,no
		$Run [Sys]<sys>Lcopy.run,(Pascal_First_with_BSS.asm), 
			From_socket,ServerSpec,,yes,,no
		$Run [Sys]<sys>Lcopy.run,(Pascal_First_with_BSS.obj), 
			From_socket,ServerSpec,,yes,,no


		$Run [Sys]<sys>Lcopy.run,(CSsocket.lib,IN.h,NETDB.h), 
			From_csocket,ServerSpec,,yes,,no
		$Run [Sys]<sys>Lcopy.run,(SFTP.c,SOCKET.h,TYPES.h), 
			From_csocket,ServerSpec,,yes,,no
		$Run [Sys]<sys>Lcopy.run,(BSTRING.h,INET.h,SOCOMPAT.h), 
			From_csocket,ServerSpec,,yes,,no
	$EndIf; Public

	$If Ch3 <> 65535 ; SocketCluster Share and FTP Client API library selected
		
		$Run [Sys]<sys>Lcopy.run,(echoserver.c,filedesc.h,get_time.c), 
			From_socket,Destpath,,yes,,no
		$Run [Sys]<sys>Lcopy.run,(multecho.c,netdb.h,netinetin.h), 
			From_socket,Destpath,,yes,,no
		$Run [Sys]<sys>Lcopy.run,(sender_udp.c,sftp.c,socket.lib,socklim.c), 
			From_socket,Destpath,,yes,,no
		$Run [Sys]<sys>Lcopy.run,(syssocket.h,systypes.h,terminal_1.c), 
			From_socket,Destpath,,yes,,no
		$Run [Sys]<sys>Lcopy.run,(terminal_2.c,terminal_3.c,udp_echo.c), 
			From_socket,Destpath,,yes,,no
		$Run [Sys]<sys>Lcopy.run,(arpainet.h,bstring.h,terminal.c), 
			From_socket,Destpath,,yes,,no
		$Run [Sys]<sys>Lcopy.run,(syssocompat.h), 
			From_socket,Destpath,,yes,,no
		$Run [Sys]<sys>Lcopy.run,(Pascal_First_with_BSS.asm), 
			From_socket,Destpath,,yes,,no
		$Run [Sys]<sys>Lcopy.run,(Pascal_First_with_BSS.obj), 
			From_socket,Destpath,,yes,,no



		$Run [Sys]<sys>Lcopy.run,(CSsocket.lib,IN.h,NETDB.h), 
			From_csocket,Destpath1,,yes,,no
		$Run [Sys]<sys>Lcopy.run,(SFTP.c,SOCKET.h,TYPES.h), 
			From_csocket,Destpath1,,yes,,no
		$Run [Sys]<sys>Lcopy.run,(BSTRING.h,INET.h,SOCOMPAT.h), 
			From_csocket,Destpath1,,yes,,no

	$EndIf ; SocketCluster Share library selected

	$If Ch2 <> 65535
		$Run [Sys]<sys>Lcopy.run,TCP.Telnet.run,From_ctos,Destpath2,,yes,,no
	$EndIf

	$DisplayLine('DONE')


	$RestartLabel

	;Copy tcpip.params

	$If Ch1 <> 65535 ; TCP, IP servers etc. copy TCPIP.Params
		Temp1 = ConcatStrings(DestPath2,'tcpip.params will be saved as save>tcpip.params  .')
		Temp1 = ConcatStrings('Existing ',Temp1)
		$DisplayLine(Temp1)
		$If SWInstal = 0
			$DisplayAndWait(GoMsg)
		$EndIf
		Temp1	= ConcatStrings(DestPath2,'TCPIP.Params')
		Temp2	= ConcatStrings(DestPath2,'save>')
;		$Command Rename,Temp1,Temp2,yes
		$Run [Sys]<sys>Lcopy.run,TCPIP.Params,DestPath2,Temp2,, 
		yes,,yes
		$DeAssign(Temp1)
		$DeAssign(Temp2)
		$Run [Sys]<sys>Lcopy.run,TCPIP.Params,From_ctos,DestPath2,, 
		yes,,yes
	$EndIf




	i = 0;
	$While (i < 6)
		i = i + 1
		$DisplayLine
	$EndWhile

	$If (Ch1 <> 65535) or (Ch2 <> 65535)  ; servers or clients selected


		;Create commands

		$Display('Creating Commands.........')

		$If Ch1 <> 65535 ; TCP, IP servers etc.
			tcp_cmds = ConcatStrings(From_sys,'tcpip1.cmds')
			$Run ([Sys]<sys>CmdFileEditor.run,MCF,'MC'), 
		 	tcp_cmds, CmdFileTo, yes, DefVol
		$EndIf

		$If Ch2 <> 65535 ; Telnet etc.
			tcp_cmds = ConcatStrings(From_sys,'tcpip2.cmds')
			$Run ([Sys]<sys>CmdFileEditor.run,MCF,'MC'), 
		 	tcp_cmds, CmdFileTo, yes, DefVol
		$EndIf

		$DisplayLine('DONE')

		$DeAssign(tcp_cmds)
	
	$Endif

		$RestartLabel

		i = 0;
		$While (i < 10)
			i = i + 1
			$DisplayLine
		$EndWhile


		$DisplayLine
		$DisplayLine(MergeMsg)
		$Display(MergeMsg2)

		ReqFile 	= ConcatStrings(Destpath2,'Request.sys')
		TCPReqtxt 	= ConcatStrings(From_sys,'Request.tcpip.txt')
		Req_Save	= ConcatStrings(Destpath2,'Save>Request.sys')
		Req_excl	= ConcatStrings(From_sys,'Request.List')
	
		$Command Copy,ReqFile,Req_save,'yes'

		$Run [Sys]<sys>ListRqSet.run, ReqFile, [scr]<$>req.txt,,@Req_excl
		$Run [Sys]<sys>MakeRqSet.run,([scr]<$>req.txt, TCPReqtxt),ReqFile

		$DeAssign(ReqFile)
		$DeAssign(TcpReqtxt)
		$DeAssign(Req_excl)
		$DeAssign(Req_Save)

		$DisplayLine('DONE')

		i = 0;
		$While (i < 10)
			i = i + 1
			$DisplayLine
		$EndWhile

		DestSpec = ConcatStrings(DefVol,'<sys>')


				
	$If InstallType <> 2 and SWInstal <> 1
		$NextFloppy(Sd2of3Msg)
		$DeAssign(Sd2of3Msg)
	$EndIf

	i = 0;
	$While (i < 7)
		i = i + 1
		$DisplayLine
	$EndWhile

	$Display(FloppyFiles)
	$If Public

		$Run [Sys]<sys>Lcopy.run,(NGI.ValidAddress,TCP.ConfigMgr.run, 
			TCP.Deinstall.run), From_ctos, ServerSpec,,yes,,no
		$Run [Sys]<sys>Lcopy.run,(TCP.FTPCL.run,TCP.InstallIP.run, 
			TCP.InstallTCP.run), From_ctos, ServerSpec,,yes,,no
		$Run [Sys]<sys>Lcopy.run,(TCP.InstallX25NGI.Run,TCP.IP.run, 
			TCP.OpManager.help), From_ctos, ServerSpec,,yes,,no
		$Run [Sys]<sys>Lcopy.run,(TCP.OpManager.run,TCP.run, 
			TCP.X25NGI.Run), From_ctos, ServerSpec,,yes,,no
		$Run [Sys]<sys>Lcopy.run,(ftp.lib,FTPLib.h,Sample.c,Sample.h), 
			From_fAPI, ServerSpec,,yes,,no

	$EndIf ;Public

	$If Ch1 <> 65535 ; Choice 1 selected

		; Copy choice 1 files from disk 2

		$Run [Sys]<sys>Lcopy.run,(TCP.ConfigMgr.run, 
			TCP.Deinstall.run,TCP.InstallIP.run,TCP.InstallTCP.run), 
			From_ctos, Destpath2,,yes,,no

		$Run [Sys]<sys>Lcopy.run,(TCP.InstallX25NGI.Run,TCP.IP.run, 
			TCP.OpManager.help,TCP.OPManager.run,TCP.run,TCP.X25NGI.Run), 
			From_ctos, Destpath2,,yes,,no
	$Endif ; Choice 1 selected

	$If Ch2 <> 65535 ; Choice 2 selected
		$Run [Sys]<sys>Lcopy.run,TCP.FTPCL.run,From_ctos, Destpath2,,yes,,no
	$EndIf

	$If Ch3 <> 65535; Choice 3 selected
		$Run [Sys]<sys>Lcopy.run,(ftp.lib,FTPLib.h,Sample.c,Sample.h), 
			From_fAPI, Destpath3,,yes,,no
	$EndIf

	$DisplayLine('DONE')

	$If Ch1 <> 65535
		; Copy NGI valid address file
		Temp1 = ConcatStrings(DestPath2,'NGI.ValidAddress will be saved as save>NGI.ValidAddress  .')
		Temp1 = ConcatStrings('Existing ',Temp1)
		$DisplayLine(Temp1)
		$If SWInstal = 0
			$DisplayAndWait(GoMsg)
		$EndIf
		Temp1	= ConcatStrings(DestPath2,'NGI.ValidAddress')
		Temp2	= ConcatStrings(DestPath2,'save>')
;		$Command Rename,Temp1,Temp2,yes
		$Run [Sys]<sys>Lcopy.run,NGI.ValidAddress,DestPath2,Temp2,,
		yes,,yes
		$Run [Sys]<sys>Lcopy.run,NGI.ValidAddress,From_ctos,DestPath2,, 
		yes,,yes
		$DeAssign(Temp1)
		$DeAssign(Temp2)
	$EndIf

	i = 0;
	$While (i < 10)
		i = i + 1
		$DisplayLine
	$EndWhile

	$If Ch1 = 65535 and Ch2 = 65535 ; Only choice 3 selected
		$GoTo End_JCL
	$EndIf

	;*************************************
	;    Files from third disk
	;*************************************

	$RestartLabel

	$If InstallType <> 2 and SWInstal <> 1
		$NextFloppy(Sd3of3Msg)
		$DeAssign(Sd3of3Msg)
	$EndIf

	i = 0;
	$While (i < 7)
		i = i + 1
		$DisplayLine
	$EndWhile

	$Display(FloppyFiles)
	$If Public
		$Run [Sys]<sys>Lcopy.run,(TCP.FTP.help,TCP.FTPClient.run,
			TCP.FTPServer.run,TCP.LogReport.run,TCP.Telnet.help,
			TCP.SMTP.run), From_ctos, ServerSpec,,yes,,no
		$Run [Sys]<sys>Lcopy.run,TCP.FTPLogCtl.run,From_ctos, 
			ServerSpec,,yes,,no
	$EndIf

	$If Ch1 <> 65535 ; Choice 1 chosen
		$Run [Sys]<sys>Lcopy.run,(TCP.FTPServer.run,TCP.SMTP.run), 
			From_ctos, Destpath2,,yes,,no
	$EndIf

	$If Ch2 <> 65535 ; Choice 2 chosen
		$Run [Sys]<sys>Lcopy.run,(TCP.FTP.help,TCP.FTPClient.run, 
			TCP.LogReport.run,TCP.Telnet.help), From_ctos, 
			Destpath2,,yes,,no
		$Run [Sys]<sys>Lcopy.run,TCP.FTPLogCtl.run, From_ctos, 
			Destpath2,,yes,,no
	$EndIf

	$DisplayLine('DONE')

	$If Ch1 <> 65535 ; Choice 2 chosen
		$Display('Creating FTP directory.........')
		ftp_dir	= ConcatStrings(DefVol,'<tcpip.FTP>')
		$Command Create Directory, ftp_dir
		$DeAssign(ftp_dir)
		$DisplayLine('DONE')
	$EndIf


End_Jcl:

;	$DisplayLine(InstDoneMsg)
	$DisplayLine(PMCntnueMsg1)
	$DisplayLine(PMCntnueMsg2)
	$DisplayLine(PMCntnueMsg3)

	i = 0;
	$While (i < 5)
		i = i + 1
		$DisplayLine
	$EndWhile

	$DeAssign(InstDoneMsg)
	$DeAssign(PMCntnueMsg1)
	$DeAssign(PMCntnueMsg2)
	$DeAssign(PMCntnueMsg3)
 
	$If (SWInstal = 0)
		DisplayAndWait(GoMsg)
	$EndIf

$END

		
