Job GpsMatrix
;GPS s2.7.0 Dot Matrix Package Installation
;SJCSJK 940701
;GPS s2.7.4 Dot Matrix package Installation
;SJCSNJ 950122
CancelOnError
PauseOff

CLS  = '\\0ch'
YES  = 255
NO   = 0
NULL = '0'

VolFrom = DeviceFrom
f5inch  = ( DeviceType( VolFrom ) < 3 )
if ( InstallType = 2 )  ;Installing from Server
  FromGps     = '[Sys]<Gps>'
  FromSys     = '[Sys]<Sys>'
  VolFrom     = '[Sys]'
  fFromServer = YES
else
  FromGps     = ConcatStrings(VolFrom, '<Gps>')
  FromSys     = ConcatStrings(VolFrom, '<Sys>')
  fFromServer = NO
endif

if ( Public )			;Installing to Server
	ToGps     = '[Sys]<Gps>'
	ToVol     = '[Sys]'
	CmdFileTo = '[Sys]<Sys>Cluster.cmds'
	fCmds = FileVersion( CmdFileTo )
	if ( fCmds = NULL )
		;no cluster.cmds file
		CmdFileTo = '[Sys]<Sys>Sys.cmds'
	endif
else
	ToGps     = '[Sys]<Gps>'
	ToVol     = '[Sys]'
	CmdFileTo = '[Sys]<Sys>Sys.cmds'
endif

;initial consistency checks
if ( fFromServer )
	;check if installation has already been done, but permit later EMUs
	Spec  = ConcatStrings( FromGps, 'APHrMatrixDD.run' )
	Ver   = FileVersion( Spec )
	fHR   = (SubString('2.7', Ver) <> 0FFFFh)
	Spec  = ConcatStrings( FromGps, 'APMatrixDD.run' )
	Ver   = FileVersion( Spec )
	fAP   = (SubString('2.7', Ver) <> 0FFFFh)
	Spec  = ConcatStrings( FromGps, 'EpFx286DD.run' )
	Ver   = FileVersion( Spec )
	fEP   = (SubString('2.7', Ver) <> 0FFFFh)
	Spec  = ConcatStrings( FromGps, 'HPPaintjetDD.run' )
	Ver   = FileVersion( Spec )
	fPJ   = (SubString('2.7', Ver) <> 0FFFFh)
	if ( fHR = NO or fAP = NO or fEP = NO or fPJ = NO )
		Display( CLS )
		DisplayLine('	*** STOP *** GPS R2.7.0 is not installed correctly')
		DisplayLine('	             at the server.  Please reinstall the')
		DisplayLine('	             R2.7.0 GPS Dot Matrix Package Public')
		DisplayLine('	             onto the server before continuing.')
		DisplayLine
		DisplayAndWait('	            Press any key to quit installation:')
		Cancel
	endif
	deassign( fHR )
	deassign( fAP )
	deassign( fEP )
	deassign( fPJ )
	Spec  = ConcatStrings( ToGps, 'GpsStatus.run' )
	Ver   = FileVersion( Spec )
	fIN   = (SubString('2.7', Ver) <> 0FFFFh)
	if ( fIN = NO )
		Display( CLS )
		DisplayLine('	*** STOP *** GPS R2.7.0 Basic Package has not been ')
		DisplayLine('	             installed.  Please first install the  ')
		DisplayLine('	             R2.7.0 GPS Basic Package.             ')
		DisplayLine
		DisplayAndWait('	            Press any key to quit installation:')
		Cancel
	endif
	Deassign( fIN )
endif
	
;initial info  user concerns
Display( CLS )
DisplayLine
DisplayLine('	AE                                                       AA')
DisplayLine('	AE       GPS s2.7.7 Dot Matrix Package Installation      AA')
DisplayLine('	AE                                                       AA')
DisplayLine
DisplayLine('	If the GPS Print Service and GPS device drivers are    ')
DisplayLine('	operating in memory, they will be shut down if necessary.')
DisplayLine('	Context Manager may operate during this installation.  ')
DisplayLine
DisplayLine('	GPS s2.7.7 is not compatible with GPS 2.6.0 or earlier ')
DisplayLine('	versions.  This requires that all client (cluster) GPS ')
DisplayLine('	workstations must otherwise be upgraded to GPS R2.6.5  ')
DisplayLine('	or R2.7.0 before resuming GPS services upon them.      ')
DisplayLine('	Please refer to the R2.7.0 SRA for additional details. ')
DisplayLine
DisplayLine('	The GPS s2.7.7 Dot Matrix Package requires about 3150  ')
DisplayLine('	sectors fully installed.  If GPS Dot Matrix drivers    ')
DisplayLine('	have previously been installed fewer sectors will be   ')
DisplayLine('	required.                                              ')
DisplayLine
DisplayAndWait('	 more   Press any key to proceed:')
Display( CLS )
DisplayLine
DisplayLine('	Installing this package to the server will install the ')
DisplayLine('	complete set of drivers (and pipe drivers, if selected)')
DisplayLine('	but when installing from diskettes or from the server  ')
DisplayLine('	you may instead specify individual Dot Matrix drivers. ')
DisplayLine
DisplayLine('	Press GO to run Volume Status to determine if there is ')
DisplayLine('	sufficient free sectors available to continue (only the')
DisplayLine('	<Sys>, <Gps> and possibly a few other directories will ')
DisplayLine('	be shown), otherwise mark \'No\' and then press GO:')
fVS = UserSelectYesNo('Run Volume Status?','Yes')
if ( fVS )
	PauseOn
	RUN [Sys]<Sys>VolumeStatus.run,ToVol,y,,'??s'
	PauseOff
	DisplayLine
	DisplayAndWait('	AEPress GO to continue, or ACTIONFINISH to quit:AA')
endif
Deassign( fVS )

MainMenu:

;clear screen
Display( CLS )

;Select GPS Dot Matrix Package items to install
;these menus are different when installing from the server or the media
if ( fFromServer or not Public )
	Options = UserSelectMultiple( 
	  'Please select s2.7.7 GPS Dot Matrix Pkg components to install:', 
	  'Complete Dot Matrix Device Drivers package      (all drivers)',
	  'Complete Dot Matrix Pipe Device Drivers package ( all pipes )',
	  'AP HighResolution Matrix Device Driver ( APHrMatrixDD.run ) ',
	  'AP LowResolution  Matrix Device Driver ( APMatrixDD.run   ) ',
	  'Epson  AP1371     Matrix Device Driver ( EpFx286DD.run    ) ',
	  'HP Paintjet        Matrix Device Driver ( HPPaintjetDD.run ) ',
	  'CT 2400 Series     Matrix Device Driver ( CTMatrixDD.run   ) ')
	fPipes = (SubString('Dot Matrix Pipe', Options) <> 0FFFFh)
	if ( not fPipes )
	PipeOpts = UserSelectMultiple( 
	  'Please select s2.7.7 GPS Dot Matrix Pipe Drivers to install:', 
	  'AP HighResolution Matrix Pipe Driver ( APHrMatrixPipe.run ) ',
	  'AP LowResolution  Matrix Pipe Driver ( APMatrixPipe.run   ) ',
	  'Epson  AP1371     Matrix Pipe Driver ( EpFx286Pipe.run    ) ',
	  'HP Paintjet        Matrix Pipe Driver ( HPPaintjetPipe.run ) ',
	  'CT 2400 Series     Matrix Pipe Driver ( CTMatrixPipe.run   ) ')
	endif
else ;from floppy
    PipeOpts = ''
	Options = UserSelectMultiple( 
	  'Please Select the s2.7.7 GPS Dot Matrix Pkg components to install:', 
	  'Dot Matrix Device Drivers package (all device drivers)',
	  'Dot Matrix Pipe Device Drivers package (all pipe drivers)', 
	  'Copy R2.7.0 GPS SRA DEF format document to <Gps> directory' )
endif

fDevice = (SubString('Dot Matrix Device', Options) <> 0FFFFh)
fPipes  = (SubString('Dot Matrix Pipe',   Options) <> 0FFFFh)
fAPHr   = (SubString('APHrMatrixDD', Options) <> 0FFFFh)
fAP     = (SubString('APMatrixDD',   Options) <> 0FFFFh)
fEpson  = (SubString('EpFx286DD',    Options) <> 0FFFFh)
fHPPJ   = (SubString('HPPaintjetDD', Options) <> 0FFFFh)
fCT     = (SubString('CTMatrixDD',   Options) <> 0FFFFh)
fSRA    = (SubString('Copy R2.7.0 GPS SRA', Options) <> 0FFFFh)
if ( fPipes )
	fAPHrP  = No
	fAPP    = No
	fEpsonP = No
	fHPPJP  = No
	fCTP    = No
else
	fAPHrP  = (SubString('APHrMatrixPipe', PipeOpts) <> 0FFFFh)
	fAPP    = (SubString('APMatrixPipe',   PipeOpts) <> 0FFFFh)
	fEpsonP = (SubString('EpFx286Pipe',    PipeOpts) <> 0FFFFh)
	fHPPJP  = (SubString('HPPaintjetPipe', PipeOpts) <> 0FFFFh)
	fCTP    = (SubString('CTMatrixPipe',   PipeOpts) <> 0FFFFh)
	Deassign( PipeOpts )
endif

;force fDevice if Public and installing drivers
if ( Public )
	if ( fAPHr or fAP or fEpson or fHPPJ or fCT )
		fDevice = YES
	endif
endif

;check for consistent options
if ( fDevice )
	if ( fAPHr or fAP or fEpson or fHPPJ or fCT )
		DisplayLine('		AEInconsistent options were selected.AA')
		DisplayAndWait('		Please press GO to try again.')
		Goto MainMenu
	endif
endif
if ( fPipes )
	if ( fAPHrP or fAPP or fEpsonP or fHPPJP or fCTP )
		DisplayLine('		AEInconsistent options were selected.AA')
		DisplayAndWait('		Please press GO to try again.')
		Goto MainMenu
	endif
	if ( fFromServer )
		Spec  = ConcatStrings( FromGps, 'DotMatrixPipe.cmds' )
		fCmds = FileVersion( Spec )
		if ( fCmds = NULL )
		Display( CLS )
		DisplayLine('	*** STOP *** R2.7.0 GPS Dot Matrix Pipe Drivers are')
		DisplayLine('	             not correctly installed at the server.')
		DisplayLine('	             Please reinstall the R2.7.0 GPS Dot Matrix')
		DisplayLine('	             Package Public to the server and select')
		DisplayLine('	             the Pipe Drivers before continuing.')
		DisplayLine
		DisplayAndWait('	            Press any key to quit installation:')
		Cancel
		endif
		Deassign( fCmds )
	endif
endif

RestartLabel
;set path to installing <Gps> directory
PATH '',ToVol,Gps,''

;shut down local GPS services
Display( CLS )
if ( (fDevice or fAPHr or fAP or fEpson or fHPPJ or fCT) and ((SystemType = 2 and not Public) or (SystemType <> 2 and Public)) )
    DisplayLine
    Display('Deinstalling local Print Service and drivers (if running) ... ')
    RUN (GpsStatus.run,,'DE'),,4
    DisplayLine('done.')
    DisplayLine
endif

RestartLabel
;basic items
if ( fFromServer )
	if ( fDevice )
		DisplayLine
		DisplayLine('Installing Dot Matrix Drivers ... ')
		Command LCopy,( 
			APHrMatrixDD.run, APMatrixDD.run, EpFx286DD.run, 
			HPPaintjetDD.run, CTMatrixDD.run ),FromGps,ToGps,,y,n,n,y
		DisplayLine('done.')
		DisplayLine
	endif
	if ( fPipes )
		DisplayLine
		Display('Installing Dot Matrix Pipe Drivers ... ')
		Command LCopy, ( 
			APHrMatrixPipe.run, APMatrixPipe.run, EpFx286Pipe.run, 
			HPPaintjetPipe.run, CTMatrixPipe.run ),FromGps,ToGps,,y,n,n,y
		DisplayLine('done.')
		DisplayLine
		DisplayLine('Merging Dot Matrix Pipe Driver commands ... ')
		Spec2 = ConcatStrings( FromGps, 'DotMatrixPipe.cmds' )
		Command 'Merge Command Files',Spec2,CmdFileTo,y,ToVol
		DisplayLine('done.')
		DisplayLine
	endif
	if ( fAPHr )
		DisplayLine
		Display('Installing AP HighResolution Matrix Driver ... ')
		Command LCopy,APHrMatrixDD.run,FromGps,ToGps,,y,n,n,y
		DisplayLine('done.')
		DisplayLine
	endif
	if ( fAP )
		DisplayLine
		Display('Installing AP LowResolution Matrix Driver ... ')
		Command LCopy,APMatrixDD.run,FromGps,ToGps,,y,n,n,y
		DisplayLine('done.')
		DisplayLine
	endif
	if ( fEpson )
		DisplayLine
		Display('Installing Epson  AP1371 Matrix Driver ... ')
		Command LCopy,EpFx286DD.run,FromGps,ToGps,,y,n,n,y
		DisplayLine('done.')
		DisplayLine
	endif
	if ( fHPPJ )
		DisplayLine
		Display('Installing HP Paintjet Matrix Driver ... ')
		Command LCopy,HPPaintjetDD.run,FromGps,ToGps,,y,n,n,y
		DisplayLine('done.')
		DisplayLine
	endif
	if ( fCT )
		DisplayLine
		Display('Installing CT 2400 Series Matrix Driver ... ')
		Command LCopy,CTMatrixDD.run,FromGps,ToGps,,y,n,n,y
		DisplayLine('done.')
		DisplayLine
	endif
	if ( fAPHrP )
		DisplayLine
		Display('Installing AP HighResolution Pipe Driver ... ')
		Command LCopy,APHrMatrixPipe.run,FromGps,ToGps,,y,n,n,y
		DisplayLine('done.')
		DisplayLine
	endif
	if ( fAPP )
		DisplayLine
		Display('Installing AP LowResolution Pipe Driver ... ')
		Command LCopy,APMatrixPipe.run,FromGps,ToGps,,y,n,n,y
		DisplayLine('done.')
		DisplayLine
	endif
	if ( fEpsonP )
		DisplayLine
		Display('Installing Epson  AP1371 Pipe Driver ... ')
		Command LCopy,EpFx286Pipe.run,FromGps,ToGps,,y,n,n,y
		DisplayLine('done.')
		DisplayLine
	endif
	if ( fHPPJP )
		DisplayLine
		Display('Installing HP Paintjet Pipe Driver ... ')
		Command LCopy,HPPaintjetPipe.run,FromGps,ToGps,,y,n,n,y
		DisplayLine('done.')
		DisplayLine
	endif
	if ( fCTP )
		DisplayLine
		Display('Installing CT 2400 Series Pipe Driver ... ')
		Command LCopy,CTMatrixPipe.run,FromGps,ToGps,,y,n,n,y
		DisplayLine('done.')
		DisplayLine
	endif

else	; fFromServer = NO

	PATH '',DeviceFrom,Sys,''
	if ( fDevice )
		DisplayLine
		DisplayLine('Installing Dot Matrix Drivers ...')
		RUN DotMatrixGps.run, ( 
			<Gps>APHrMatrixDD.run, <Gps>APMatrixDD.run, 
			<Gps>EpFx286DD.run, <Gps>HPPaintjetDD.run, 
			<Gps>CTMatrixDD.run ),,y,n,,,ToVol
		DisplayLine
	endif
	if ( fAPHr or fAP or fEpson or fHPPJ or fCT )
		DisplayLine
		Spec1 = '\'\''
		Spec2 = '\'\''
		Spec3 = '\'\''
		Spec4 = '\'\''
		Spec5 = '\'\''
	endif
	if ( fAPHr )
		DisplayLine('Installing AP HighResolution Matrix Driver ...')
		Spec1 = '<Gps>APHrMatrixDD.run'
	endif
	if ( fAP )
		DisplayLine('Installing AP LowResolution Matrix Driver ...')
		Spec2 = '<Gps>APMatrixDD.run'
	endif
	if ( fEpson )
		DisplayLine('Installing Epson  AP1371 Matrix Driver ...')
		Spec3 = '<Gps>EpFx286DD.run'
	endif
	if ( fHPPJ )
		DisplayLine('Installing HP Paintjet Matrix Driver ...')
		Spec4 = '<Gps>HPPaintjetDD.run'
	endif
	if ( fCT )
		DisplayLine('Installing CT 2400 Series Matrix Driver ...')
		Spec5 = '<Gps>CTMatrixDD.run'
	endif
	if ( fAPHr or fAP or fEpson or fHPPJ or fCT )
		RUN DotMatrixGps.run, 
			( Spec1, Spec2, Spec3, Spec4, Spec5 ),,y,n,,,ToVol
		DisplayLine
		DisplayLine('done.')
	endif
	if ( fPipes or fAPHrP or fAPP or fEpsonP or fHPPJP or fCTP )
		if ( f5inch )
			DisplayLine
			DisplayLine
			NextFloppy('s2.7.7 Gps Dot Matrix Pkg 2 of 2')
			DisplayLine
		endif
	endif
	if ( fPipes )
		DisplayLine
		Display('Installing Dot Matrix Pipe Drivers ... ')
		RUN DotMatrixGps.run, ( 
			<Gps>APHrMatrixPipe.run, <Gps>APMatrixPipe.run, 
			<Gps>EpFx286Pipe.run, <Gps>HPPaintjetPipe.run, 
			<Gps>CTMatrixPipe.run, <Gps>DotMatrixPipe.cmds ),
			,y,n,,,ToVol
		DisplayLine
		PATH '',ToVol,Gps,''
		Display('Merging Dot Matrix Pipe Driver commands ... ')
		Command 'Merge Command Files',DotMatrixPipe.cmds,CmdFileTo,y,ToVol
		DisplayLine('done.')
		DisplayLine
		PATH '',DeviceFrom,Sys,''
	endif
	if ( fAPHrP or fAPP or fEpsonP or fHPPJP or fCTP )
		DisplayLine
		Spec1 = '\'\''
		Spec2 = '\'\''
		Spec3 = '\'\''
		Spec4 = '\'\''
		Spec5 = '\'\''
	endif
	if ( fAPHrP )
		DisplayLine('Installing AP HighResolution Matrix Pipe Driver ...')
		Spec1 = '<Gps>APHrMatrixPipe.run'
	endif
	if ( fAPP )
		DisplayLine('Installing AP LowResolution Matrix Pipe Driver ...')
		Spec2 = '<Gps>APMatrixPipe.run'
	endif
	if ( fEpsonP )
		DisplayLine('Installing Epson  AP1371 Matrix Pipe Driver ...')
		Spec3 = '<Gps>EpFx286Pipe.run'
	endif
	if ( fHPPJP )
		DisplayLine('Installing HP Paintjet Matrix Pipe Driver ...')
		Spec4 = '<Gps>HPPaintjetPipe.run'
	endif
	if ( fCTP )
		DisplayLine('Installing CT 2400 Series Matrix Pipe Driver ...')
		Spec5 = '<Gps>CTMatrixPipe.run'
	endif
	if ( fAPHrP or fAPP or fEpsonP or fHPPJP or fCTP )
		RUN DotMatrixGps.run, 
			( Spec1, Spec2, Spec3, Spec4, Spec5 ),,y,n,,,ToVol
		DisplayLine
		DisplayLine('done.')
		DisplayLine
	endif
	if ( fSRA )
		DisplayLine('Copying GPS R2.7.0 SRA document ... ')
		DisplayLine
		RUN DotMatrixGps.run,<Gps>R2.7.0>DotMatrixGps.SRA,,y,n,,,ToVol
		DisplayLine
	endif
endif

RestartLabel
PATH '',ToVol,Gps,''
if ( not fDevice and not fPipes )
	if ( fAPHrP or fAPP or fEpsonP or fHPPJP or fCTP )
		DisplayLine
		Display('Merging Dot Matrix Pipe Driver commands ... ')
		;get local copy to modify
		if ( fFromServer )
			Command LCopy,DotMatrixPipe.cmds,FromGps,ToGps,,y,n,n,y
		else
			PATH '',DeviceFrom,Sys,''
			RUN DotMatrixGps.run, 
				<Gps>DotMatrixPipe.cmds,,y,n,,,ToVol
			PATH '',ToVol,Gps,''
		endif
		if ( not fAPHrP )
			Command 'Remove Command','Pipe APHrMatrix',DotMatrixPipe.cmds
		endif
		if ( not fAPP )
			Command 'Remove Command','Pipe APMatrix',DotMatrixPipe.cmds
		endif
		if ( not fEpsonP )
			Command 'Remove Command','Pipe Epson',DotMatrixPipe.cmds
		endif
		if ( not fHPPJP )
			Command 'Remove Command','Pipe Paintjet',DotMatrixPipe.cmds
		endif
		if ( not fCTP )
			Command 'Remove Command','Pipe CTMatrix',DotMatrixPipe.cmds
		endif
		Command 'Merge Command Files',DotMatrixPipe.cmds,CmdFileTo,y,ToVol
		Command Delete,DotMatrixPipe.cmds
		DisplayLine
		DisplayLine('done.')
		DisplayLine
	endif
endif

Display( CLS )
DisplayLine
DisplayLine('	AE                                                           AA')
DisplayLine('	AE      Installation of GPS Dot Matrix Package Complete      AA')
DisplayLine('	AE                                                           AA')
DisplayAndWait('	                Press any key to Finish')

END
;End GpsMatrix
Command LCopy,APMatrixPipe.run,FromGps,ToGps,,y,n,n,y
		DisplayLine('done.')
		DisplayLine
	endif
	if ( fEpsonP )
		DisplayLine
		Display('Installing Epson  AP1371 Pipe Driver ... ')
		Command LCopy,EpFx286Pipe.run,FromGps,ToGps,,y,n,n,y
		DisplayLine('done.')
		DisplayLine
	endif
	if ( fHPPJP )
		DisplayLine
		Display('Installing HP Paintjet Pipe Driver ... ')
		Command LCopy,HPPaintjetPipe.run,FromGps,ToGps,,y,n,n,y
		DisplayLine('done.')
		DisplayLine
	endif
	if ( fC