ContinueOnError

; This is an install of Batch Manager II

	PauseOff

	; Nationalizable strings
	DoneMsg       = 'done.'
	CommandMsg    = 'Creating Commands ... '
	BatchDirMsg   = 'Creating <Batch> directory ... '
	CopyMsg1	  = 'Copying Batch.run and'
	CopyMsg2	  = '        BatchMsg.bin ... '
	CopyMsg3	  = 'Copying BatchStatus.run,'
	CopyMsg4	  = '        BatchStatusForm.lib, and'
	CopyMsg5	  = '        BatchSupvsr.run ...'
	CopyMsg6	  = 'Copying BatchMgr.run ... '
	CopyMsg7	  = 'Copying InstallBatch.run,'
	CopyMsg8	  = '        InstallBatchBS.run,'
	CopyMsg9	  = '        InstallBMgr.run, and'
	CopyMsg10	  = '        InstallBSpr.run ... '
	InstallMsg    = 'Installation complete.  '
	InstallMsg1   = 'Installation complete.  Remove and store diskettes.'
	InstallMsg2   = 'Resume Cluster if Disable Cluster was invoked.'
	InstallMsg3   = 'Since request codes were added, please reboot the server.'
	InstallMsg4   = 'Press any key to finish.'
	RequestMsg	  = 'Installing New Requests for Cli.run ... '
	BMInstalled1  = 'Batch Manager is installed in a background partition.'
	BMInstalled2  = 'Please use Batch Status to remove all background'
	BMInstalled3  = 'Batch queues and then restart installation.'
	BInstalled1	  = 'Batch is executing on a board and cannot be overwritten.'
	BInstalled2	  = 'Please terminate all Batch.run files before proceeding.'
	TapeMsg		  = 'Batch Manager cannot be installed from Tape.'	
	CopyRtMsg1	  = 'Copyright  1992 Unisys Corporation.'
	CopyRtMsg2	  = 'All rights reserved.'
	CopyRtMsg3	  = 'UNISYS PROPRIETARY'

	; Do not change the length of the following strings

	NoUnattended   = '  AE Unattended mode is not supported on floppy installation. AA'
	PressGO		   = '  AE                                     Press <GO> to exit   AA'
	NoPublic	   = '  AE Public installation from server is invalid.              AA'

	; This directory will have to be changed for each release.
	; This is an engineering nationalization issue, not a subsidiary issue.

	CDRomSpec       = ConcatStrings(DeviceFrom, '<BM22.4.0>')

	; Initialize variables  do not nationalize
	Floppy		 	= 0
	Tape  		 	= 1
	FromServer	 	= 2
	FromCDRom	 	= 5
	FileInUse		= 220
	ClientVol       = '[Sys]'
	ServerVol       = '[Sys]'
	BatchDir        = '<Batch>'
	ClientSpec      = '[Sys]<Sys>'
	ServerSpec      = '[Sys]<Sys>'
	FloppyPath		= '[f0]<sys>'
	ClstrCmds		= '[Sys]<Sys>Cluster.cmds'
	BM2of2Msg       = 'Batch Manager Diskette 2 of 2'

	; Scroll four lines on the screen
	i = 0
	While (i < 4)
		i = i + 1
		DisplayLine
	EndWhile

	$IF Unattended AND (InstallType = Floppy)
		$DisplayLine
		$DisplayLine
		$DisplayLine(NoUnattended)
		$DisplayLine(PressGO)
		$DisplayLine
		$DisplayLine
		$DisplayAndWait
		$Cancel
	$ENDIF

	SvrSysType = FileVersion('[Sys]<Sys>SysImage.sys')
	ClstrSysType = FileVersion('[Sys]<Sys>SysImage.sys')

	$IF (InstallType = FromServer) AND (Public OR (SvrSysType = ClstrSysType))
		$DisplayLine
		$DisplayLine
		$DisplayLine(NoPublic)
		$DisplayLine(PressGO)
		$DisplayLine
		$DisplayLine
		$DisplayAndWait
		$Cancel
	$ENDIF

	; the majority of batch files MUST reside in [Sys]<Sys>
  	If Public
		CmdFileTo 	= ClstrCmds
		InstallPath = ServerSpec
		DefVol 		= ServerVol
		BatchPath   = ConcatStrings(ServerVol, BatchDir)
	Else
		InstallPath = ClientSpec
		DefVol 		= ClientVol
		BatchPath   = ConcatStrings(ClientVol, BatchDir)
	Endif

	If InstallType EQ Floppy
		InstallFrom = ConcatStrings(DeviceFrom, '<Unisys>')
		FloppyPath = ConcatStrings(DeviceFrom, '<sys>')
	Endif

	If InstallType EQ FromServer
		InstallFrom = ServerSpec
	Endif

	If InstallType EQ FromCDRom
		InstallFrom = CDRomSpec
	Endif

	If InstallType EQ Tape
		DisplayLine
		DisplayLine(TapeMsg)
		DisplayLine(InstallMsg4)
		DisplayAndWait
		Cancel
	Endif


    DisplayLine
    DisplayLine(CopyRtMsg1)
    DisplayLine(CopyRtMsg2)
    DisplayLine(CopyRtMsg3)
	DisplayLine
	Display(BatchDirMsg)
	Command Create Directory, BatchPath
	DisplayLine(DoneMsg)

	; Copy files from the first floppy
	RestartLabel
	DisplayLine
	DisplayLine(CopyMsg1)
	Display(CopyMsg2)
	Run [Sys]<Sys>LCopy.run, (Batch.run, BatchMsg.bin), InstallFrom 
				,InstallPath,,y,n,n,y
	If erc = FileInUse
		DisplayLine
		DisplayLine
		DisplayLine(BInstalled1)
		DisplayLine(BInstalled2)
		DisplayAndWait(InstallMsg4)
		Cancel
	Endif

	DisplayLine(DoneMsg)
	RestartLabel
	DisplayLine(CopyMsg3)
	DisplayLine(CopyMsg4)
	Display(CopyMsg5)
	Run [Sys]<Sys>LCopy.run, (BatchStatus.run, BatchSupvsr.run, 
		BatchStatusForm.Lib),InstallFrom,InstallPath,,y,,,y
	DisplayLine(DoneMsg)

	If ((InstallType = Floppy) AND 
		((DeviceType(DeviceFrom) = 1) OR (DeviceType(DeviceFrom) = 2)))

		RestartLabel

		; prompt for second floppy insertion
		DisplayLine
		DisplayLine
		NextFloppy(BM2of2Msg)
		DisplayLine
		DisplayLine
	EndIf

	; copy files from second floppy
    Display(CopyMsg6)
	Run [Sys]<Sys>LCopy.run, BatchMgr.run,InstallFrom,InstallPath,,y,n,n,y
	If erc = FileInUse
		DisplayLine
		DisplayLine
		DisplayLine(BMInstalled1)
		DisplayLine(BMInstalled2)
		DisplayLine(BMInstalled3)
		DisplayAndWait(InstallMsg4)
		Cancel
	EndIf

	DisplayLine(DoneMsg)
	RestartLabel
	DisplayLine(CopyMsg7)
	DisplayLine(CopyMsg8)
	DisplayLine(CopyMsg9)
	Display(CopyMsg10)
	Run [Sys]<Sys>LCopy.run, (InstallBatch.run, InstallBatchBS.run, 
		InstallBMgr.run, InstallBSpr.run), 
		InstallFrom,InstallPath,,y,,,y
	DisplayLine(DoneMsg)
	
	DisplayLine

	If SRPServer AND Public
		Run [Sys]<Sys>LCopy.run, Cli.run,InstallFrom,InstallPath,,y,,,y
	
		RestartLabel
		; install new Cli request 
		If InstallType = Floppy
			CliRequest = ConcatStrings(FloppyPath, 'Request.Cli.Sys')
		Else
			CliRequest = ConcatStrings(InstallPath, 'Request.Cli.Sys')
		EndIf
		Display(RequestMsg)
		$Run ([Sys]<Sys>ListRqSet.run, 'List Request Set', '01'), 
			(CliRequest, [Sys]<Sys>request.sys), 
			[scr]<$>request.cli.txt,,
		$Run ([Sys]<Sys>MakeRqSet.run, 'Make Request Set', 
			'00'),[scr]<$>request.cli.txt, [Sys]<Sys>request.sys,,,
		DisplayLine(DoneMsg)
	EndIf


	RestartLabel
	; Add Batch Manager commands
	Display(CommandMsg)
	Run ([Sys]<Sys>CmdFileEditor.run, 'Merge Command Files', 'MC'), 
				CmdFileFrom,	
				CmdFileTo,		
				Yes,			
				DefVol	
	DisplayLine(DoneMsg)

	RestartLabel
	DisplayLine
	If InstallType = Floppy
		DisplayLine(InstallMsg1)
	Else
		DisplayLine(InstallMsg)
	Endif

	DisplayLine(InstallMsg2)
	If SRPServer And Public
		DisplayLine(InstallMsg3)
	EndIf

	If InstallType NE FromCDRom
		DisplayAndWait(InstallMsg4)
		DisplayLine
	Endif

	PauseOn

End
from Tape.'	
	CopyRtMsg1	  = 'Copyright  1992 Unisys Corporation.'
	CopyRtMsg2	  = 'All rights reserved.'
	CopyRtMsg3	  = '