Job GpsLaser
;GPS s2.7.2 Laser Package Installation
;SJCSJK 940701
;GPS s2.7.4 Laser Package Installation
;SJCSNJ 960122
;GPS s2.7.7 Laser Package Installation
;Chacko 970217
;
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, 'PCL5DD.run' )
	Ver   = FileVersion( Spec )
	fPCL5 = (SubString('2.7', Ver) <> 0FFFFh)
	Spec  = ConcatStrings( FromGps, 'PSDD.run' )
	Ver   = FileVersion( Spec )
	fPS   = (SubString('2.7', Ver) <> 0FFFFh)
	Spec  = ConcatStrings( FromGps, 'APLaserDD.run' )
	Ver   = FileVersion( Spec )
	fAP   = (SubString('2.7', Ver) <> 0FFFFh)
	Spec  = ConcatStrings( FromGps, 'HPLaserjetDD.run' )
	Ver   = FileVersion( Spec )
	fHP   = (SubString('2.7', Ver) <> 0FFFFh)
	if ( fPCL5 = NO or fPS = NO or fAP = NO or fHP = 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 Laser Package Public onto')
		DisplayLine('	             the server before continuing.')
		DisplayLine
		DisplayAndWait('	            Press any key to quit installation:')
		Cancel
	endif
	deassign( fPCL5 )
	deassign( fPS )
	deassign( fAP )
	deassign( fHP )
	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 Laser 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 Laser Package requires about 3200       ')
DisplayLine('	sectors fully installed.  If GPS Laser drivers have    ')
DisplayLine('	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 Laser 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 Laser 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 Laser Package components to install:', 
	  'Complete Laser Device Drivers package      (all drivers)',
	  'Complete Laser Pipe Device Drivers package ( all pipes )',
	  'HP PCL5 Printer Language   Device Driver ( PCL5DD.run       )',
	  'Postscript Language        Device Driver ( PSDD.run         )',
	  'HP PCL2 Laserjet II Series Device Driver ( HPLaserjetDD.run )',
	  'Unisys AP Laser Series     Device Driver ( APLaserDD.run    )',
	  'Unisys AP92151 Laser      Device Driver ( APVLaserDD.run   )',
	  'Imagen 8300 Series         Device Driver ( Imagen8300DD.run )')
	fPipes = (SubString('Laser Pipe', Options) <> 0FFFFh)
	if ( not fPipes )
	PipeOpts = UserSelectMultiple( 
	  'Please select s2.7.7 GPS Laser Package Pipe Drivers to install:', 
	  'HP PCL5 Printer Language   Pipe Driver ( PCL5Pipe.run       )',
	  'Postscript Language        Pipe Driver ( PSPipe.run         )',
	  'HP PCL2 Laserjet II Series Pipe Driver ( HPLaserjetPipe.run )',
	  'Unisys AP Laser Series     Pipe Driver ( APLaserPipe.run    )',
	  'Unisys AP92151 Laser      Pipe Driver ( APVLaserPipe.run   )',
	  'Imagen 8300 Series         Pipe Driver ( Imagen8300Pipe.run )')
	endif
else ;from floppy
    PipeOpts = ''
	Options = UserSelectMultiple( 
	  'Please Select the s2.7.7 GPS Laser Package components to install:', 
	  'Laser Device Drivers package (all device drivers)',
	  'Laser Pipe Device Drivers package (all pipe drivers)', 
	  'Copy R2.7.0 GPS SRA DEF format document to <Gps> directory' )
endif

fDevice = (SubString('Laser Device Drivers', Options) <> 0FFFFh)
fPipes  = (SubString('Laser Pipe Device Drivers', Options) <> 0FFFFh)
fPCL5   = (SubString('PCL5DD', Options) <> 0FFFFh)
fPS     = (SubString('PSDD',   Options) <> 0FFFFh)
fAPL    = (SubString('APLaserDD', Options) <> 0FFFFh)
fHPLJ   = (SubString('HPLaserjetDD', Options) <> 0FFFFh)
fAPV    = (SubString('APVLaserDD',Options) <> 0FFFFh)
fImagen = (SubString('Imagen8300DD',Options) <> 0FFFFh)
fSRA    = (SubString('Copy R2.7.0 GPS SRA', Options) <> 0FFFFh)
if ( fPipes )
	fPCL5P = No
	fPSP   = No
	fAPLP  = No
	fHPLJP = No
	fAPVP  = No
	fImagP = No
else
	fPCL5P  = (SubString('PCL5Pipe', PipeOpts) <> 0FFFFh)
	fPSP    = (SubString('PSPipe',   PipeOpts) <> 0FFFFh)
	fAPLP   = (SubString('APLaserPipe',    PipeOpts) <> 0FFFFh)
	fHPLJP  = (SubString('HPLaserjetPipe', PipeOpts) <> 0FFFFh)
	fAPVP   = (SubString('APVLaserPipe',   PipeOpts) <> 0FFFFh)
	fImagP  = (SubString('Imagen8300Pipe', PipeOpts) <> 0FFFFh)
	Deassign ( PipeOpts )
endif

;force fDevice if Public and installing drivers
if ( Public )
	if ( fPCL5 or fPS or fAPL or fHPLJ or fAPV or fImagen )
		fDevice = YES
	endif
endif

;check for consistent options
if ( fDevice )
	if ( fPCL5 or fPS or fAPL or fHPLJ or fAPV or fImagen )
		DisplayLine('		AEInconsistent options were selected.AA')
		DisplayAndWait('		Please press GO to try again.')
		Goto MainMenu
	endif
endif
if ( fPipes )
	if ( fPCL5P or fPSP or fAPLP or fHPLJP or fAPVP or fImagP )
		DisplayLine('		AEInconsistent options were selected.AA')
		DisplayAndWait('		Please press GO to try again.')
		Goto MainMenu
	endif
	if ( fFromServer )
		Spec  = ConcatStrings( FromGps, 'LaserPipe.cmds' )
		fCmds = FileVersion( Spec )
		if ( fCmds = NULL )
		Display( CLS )
		DisplayLine('	*** STOP *** R2.7.0 GPS Laser Pipe Drivers are not')
		DisplayLine('	             installed correctly at the server.')
		DisplayLine('	             Please reinstall the R2.7.0 GPS Laser')
		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 )
DisplayLine
if ( (fDevice or fPCL5 or fPS or fAPL or fHPLJ or fAPV or fImagen) and ((SystemType = 2 and not Public) or (SystemType <> 2 and Public)) )
    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 Laser Drivers ... ')
		Command LCopy,( 
			PCL5DD.run, PSDD.run, APLaserDD.run, APVLaserDD.run, 
			HPLaserjetDD.run, Imagen8300DD.run, BTOSCharSetDLF.font, 
			PSDD>SerialSetup.ps ),FromGps,ToGps,,y,n,n,y
		DisplayLine('done.')
		DisplayLine
	endif
	if ( fPipes )
		DisplayLine
		Display('Installing Laser Pipe Drivers ... ')
		Command LCopy, ( 
			PCL5Pipe.run, PSPipe.run, APLaserPipe.run, 
			APVLaserPipe.run, HPLaserjetPipe.run, 
			Imagen8300Pipe.run, BTOSCharSetDLF.font ),FromGps,ToGps,,y,n,n,y
		DisplayLine('done.')
		DisplayLine
		DisplayLine('Merging Laser Pipe Driver commands ... ')
		Spec2 = ConcatStrings( FromGps, 'LaserPipe.cmds' )
		Command 'Merge Command Files',Spec2,CmdFileTo,y,ToVol
		DisplayLine('done.')
		DisplayLine
	endif
	if ( fPCL5 )
		DisplayLine
		Display('Installing HP PCL5 Printer Language Driver ... ')
		Command LCopy,PCL5DD.run,FromGps,ToGps,,y,n,n,y
		DisplayLine('done.')
		DisplayLine
	endif
	if ( fPS )
		DisplayLine
		DisplayLine('Installing Postscript Language Driver and ')
		Display('    PSDD>SerialSetup.ps serial init file ... ')
		Command LCopy,(PSDD.run,PSDD>SerialSetup.ps),FromGps,ToGps,,y,n,n,y
		DisplayLine('done.')
		DisplayLine
	endif
	if ( fAPL )
		DisplayLine
		Display('Installing Unisys AP Laser Series Driver ... ')
		Command LCopy,APLaserDD.run,FromGps,ToGps,,y,n,n,y
		DisplayLine('done.')
		DisplayLine
	endif
	if ( fAPV )
		DisplayLine
		Display('Installing Unisys AP92151 Laser Driver ... ')
		Command LCopy,APVLaserDD.run,FromGps,ToGps,,y,n,n,y
		DisplayLine('done.')
		DisplayLine
	endif
	if ( fHPLJ )
		DisplayLine
		Display('Installing HP PCL2 Laserjet II Series Driver ... ')
		Command LCopy,HPLaserjetDD.run,FromGps,ToGps,,y,n,n,y
		DisplayLine('done.')
		DisplayLine
	endif
	if ( fImagen )
		DisplayLine
		Display('Installing Imagen 8300 Series Driver ... ')
		Command LCopy,Imagen8300DD.run,FromGps,ToGps,,y,n,n,y
		DisplayLine('done.')
		DisplayLine
	endif
	if ( fPCL5P )
		DisplayLine
		Display('Installing HP PCL5 Printer Language Pipe Driver ... ')
		Command LCopy,PCL5Pipe.run,FromGps,ToGps,,y,n,n,y
		DisplayLine('done.')
		DisplayLine
	endif
	if ( fPSP )
		DisplayLine
		Display('Installing Postscript Language Pipe Driver ... ')
		Command LCopy,PSPipe.run,FromGps,ToGps,,y,n,n,y
		DisplayLine('done.')
		DisplayLine
	endif
	if ( fAPLP )
		DisplayLine
		Display('Installing Unisys AP Laser Series Pipe Driver ... ')
		Command LCopy,APLaserPipe.run,FromGps,ToGps,,y,n,n,y
		DisplayLine('done.')
		DisplayLine
	endif
	if ( fAPVP )
		DisplayLine
		Display('Installing Unisys AP92151 Laser Pipe Driver ... ')
		Command LCopy,APVLaserPipe.run,FromGps,ToGps,,y,n,n,y
		DisplayLine('done.')
		DisplayLine
	endif
	if ( fHPLJP )
		DisplayLine
		Display('Installing HP PCL2 Laserjet II Series Pipe Driver ... ')
		Command LCopy,HPLaserjetPipe.run,FromGps,ToGps,,y,n,n,y
		DisplayLine('done.')
		DisplayLine
	endif
	if ( fImagP )
		DisplayLine
		Display('Installing Imagen 8300 Series Pipe Driver ... ')
		Command LCopy,Imagen8300Pipe.run,FromGps,ToGps,,y,n,n,y
		DisplayLine('done.')
		DisplayLine
	endif
	if ( fAPL or fAPV or fAPLP or fAPVP )
		DisplayLine
		Display('Copying AP Laser BTOSCharSetDLF.font file ... ')
		Command LCopy,BTOSCharSetDLF.font,FromGps,ToGps,,y,n,n,y
		DisplayLine('done.')
		DisplayLine
	endif

else	; fFromServer = NO

	PATH '',DeviceFrom,Sys,''
	if ( fDevice )
		DisplayLine
		DisplayLine('Installing Laser Drivers ...')
		RUN LaserGps.run, ( 
			<Gps>PCL5DD.run, <Gps>PSDD.run, <Gps>APLaserDD.run, 
			<Gps>APVLaserDD.run, <Gps>HPLaserjetDD.run, 
			<Gps>Imagen8300DD.run, <Gps>BTOSCharSetDLF.font, 
			<Gps>PSDD>SerialSetup.ps ),,y,n,,,ToVol
		DisplayLine
	endif
	if ( fPCL5 or fPS or fAPL or fHPLJ or fAPV or fImagen )
		DisplayLine
		Spec1 = '\'\''
		Spec2 = '\'\''
		Spec3 = '\'\''
		Spec4 = '\'\''
		Spec5 = '\'\''
		Spec6 = '\'\''
	endif
	if ( fPCL5 )
		DisplayLine('Installing HP PCL5 Printer Language Driver ... ')
		Spec1 = '<Gps>PCL5DD.run'
	endif
	if ( fPS )
		DisplayLine('Installing Postscript Language Driver ... ')
		Spec2 = '<Gps>PSDD.run'
	endif
	if ( fAPL )
		DisplayLine('Installing Unisys AP Laser Series Driver ... ')
		Spec3 = '<Gps>APLaserDD.run'
	endif
	if ( fAPV )
		DisplayLine('Installing Unisys AP92151 Laser Driver ... ')
		Spec4 = '<Gps>APVLaserDD.run'
	endif
	if ( fHPLJ )
		DisplayLine('Installing HP PCL2 Laserjet II Series Driver ... ')
		Spec5 = '<Gps>HPLaserjetDD.run'
	endif
	if ( fImagen )
		DisplayLine('Installing Imagen 8300 Series Driver ... ')
		Spec6 = '<Gps>Imagen8300DD.run'
	endif
	Spec7 = '\'\''
	if ( fAPL or fAPV or fAPLP or fAPVP )
		Display('Installing AP Laser BTOSCharSetDLF.font file ... ')
		Spec7 = '<Gps>BTOSCharSetDLF.font'
	endif
	Spec8 = '\'\''
	if ( fPS )
		Display('Installing PSDD>SerialSetup.ps serial init file ... ')
		Spec8 = '<Gps>PSDD>SerialSetup.ps'
	endif
	if ( fPCL5 or fPS or fAPL or fHPLJ or fAPV or fImagen )
		RUN LaserGps.run,
		    ( Spec1,Spec2,Spec3,Spec4,Spec5,Spec6,Spec7,Spec8 ), 
		    	,y,n,,,ToVol
		DisplayLine
		DisplayLine('done.')
	endif
	Deassign( Spec7 )
	Deassign( Spec8 )
	if ( fPipes or fPCL5P or fPSP or fAPLP or fHPLJP or fAPVP or fImagP )
		if ( f5inch )
			DisplayLine
			DisplayLine
			NextFloppy('s2.7.7 Gps Laser Package 2 of 2')
			DisplayLine
		endif
	endif
	if ( fPipes )
		DisplayLine
		Display('Installing Laser Pipe Drivers ... ')
		RUN LaserGps.run, ( 
			<Gps>PCL5Pipe.run, <Gps>PSPipe.run, 
			<Gps>APLaserPipe.run, <Gps>LaserPipe.cmds, 
			<Gps>APVLaserPipe.run, <Gps>HPLaserjetPipe.run, 
			<Gps>Imagen8300Pipe.run, <Gps>BTOSCharSetDLF.font ),,y,n,,,ToVol
		DisplayLine
		PATH '',ToVol,Gps,''
		Display('Merging Laser Pipe Driver commands ... ')
		Command 'Merge Command Files',LaserPipe.cmds,CmdFileTo,y,ToVol
		DisplayLine('done.')
		DisplayLine
		PATH '',DeviceFrom,Sys,''
	endif
	if ( fPCL5P or fPSP or fAPLP or fHPLJP or fAPVP or fImagP )
		DisplayLine
		Spec1 = '\'\''
		Spec2 = '\'\''
		Spec3 = '\'\''
		Spec4 = '\'\''
		Spec5 = '\'\''
		Spec6 = '\'\''
		Spec6 = '\'\''
	endif
	if ( fPCL5P )
		DisplayLine('Installing HP PCL5 Printer Language Pipe Driver ... ')
		Spec1 = '<Gps>PCL5Pipe.run'
	endif
	if ( fPSP )
		DisplayLine('Installing Postscript Language Pipe Driver ... ')
		Spec2 = '<Gps>PSPipe.run'
	endif
	if ( fAPLP )
		DisplayLine('Installing Unisys AP Laser Series Pipe Driver ... ')
		Spec3 = '<Gps>APLaserPipe.run'
	endif
	if ( fAPVP )
		DisplayLine('Installing Unisys AP92151 Laser Pipe Driver ... ')
		Spec4 = '<Gps>APVLaserPipe.run'
	endif
	if ( fHPLJP )
		DisplayLine('Installing HP PCL2 Laserjet II Series Pipe Driver ... ')
		Spec5 = '<Gps>HPLaserjetPipe.run'
	endif
	if ( fImagP )
		DisplayLine('Installing Imagen 8300 Series Pipe Driver ... ')
		Spec6 = '<Gps>Imagen8300Pipe.run'
	endif
	if ( fPCL5P or fPSP or fAPLP or fHPLJP or fAPVP or fImagP )
		RUN LaserGps.run, 
		   ( Spec1, Spec2, Spec3, Spec4, Spec5, Spec6 ),,y,n,,,ToVol
		DisplayLine
		DisplayLine('done.')
		DisplayLine
	endif
	if ( fSRA )
		DisplayLine('Copying GPS R2.7.0 SRA document ... ')
		DisplayLine
		RUN LaserGps.run,<Gps>R2.7.0>LaserGps.SRA,,y,n,,,ToVol
		DisplayLine
	endif
endif

RestartLabel
PATH '',ToVol,Gps,''
if ( not fDevice and not fPipes )
	if ( fPCL5P or fPSP or fAPLP or fHPLJP or fAPVP or fImagP )
		DisplayLine
		Display('Merging Laser Pipe Driver commands ... ')
		;get local copy to modify
		if ( fFromServer )
			Command LCopy,LaserPipe.cmds,FromGps,ToGps,,y,n,n,y
		else
			PATH '',DeviceFrom,Sys,''
			RUN LaserGps.run,<Gps>LaserPipe.cmds,,y,n,,,ToVol
			PATH '',ToVol,Gps,''
		endif
		if ( not fPCL5P )
			Command 'Remove Command','Pipe PCL5',LaserPipe.cmds
		endif
		if ( not fPSP )
			Command 'Remove Command','Pipe Postscript',LaserPipe.cmds
		endif
		if ( not fAPLP )
			Command 'Remove Command','Pipe APLaser',LaserPipe.cmds
		endif
		if ( not fHPLJP )
			Command 'Remove Command','Pipe HPLaser',LaserPipe.cmds
		endif
		if ( not fAPVP )
			Command 'Remove Command','Pipe APVLaser',LaserPipe.cmds
		endif
		if ( not fImagP )
			Command 'Remove Command','Pipe Imagen',LaserPipe.cmds
		endif
		Command 'Merge Command Files',LaserPipe.cmds,CmdFileTo,y,ToVol
		Command Delete,LaserPipe.cmds
		DisplayLine
		DisplayLine('done.')
		DisplayLine
	endif
endif

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

END
;End GpsLaser
un, ( 
			<Gps>PCL5DD.run, <Gps>PSDD.run, <Gps>APLaserDD.run, 
			<Gps>APVLaserDD.run, <Gps>HPLaserjetDD.run, 
			<Gps>Imagen8300DD.run, <Gps>BTOSCharSetDLF.font, 
			<Gps>PSDD>Seri