$Job MailInstall
;
;	The installation of 8.0.0 Mail can be done from Floppy or Server.
$PauseOff
;
; Nationalizable Strings.
FloppyMsg1 = 'Copying from first floppy:'
FloppyMsg2 = 'Copying from second floppy:'
FloppyMsg3 = 'Copying from third floppy:'
ServerMsg = 'Copying files from the server ... '
MergeMsg = 'Merging request files ... '
CommandMsg = 'Creating commands ... '
CmPrompt = 'CM Config file name'
DoneMsg = 'done.'
ErrOldOs = 'You must be running CTOS 9.1 or greater for 8.0.0 OFIS Mail to install properly.'
SelectPrompt = 'Select items to be installed.'
WantRel = 'Copy ReleaseNotice to disk.'
WantLib = 'Copy Mail.Lib to disk.'
WantCm = 'Add Mail command to Context Manager configuration file.'
FloppySpec2 = 'OFIS Mail 8.0.0 disk 2 of 3'
FloppySpec3 = 'OFIS Mail 8.0.0 disk 3 of 3'
;
;	Initialize the variables.
true = 65535
notfound = 65535
false = 0
floppy = 0
tape = 1
serverInst = 2
;
stnd = 0
clstr = 1
clstrlfs = 2
server = 3

;
LocalSpec = '[Sys]<Sys>'
ServerSpec = '[Sys]<Sys>'
ProcessRqs = false
CopyRelNote = notfound
CopyMailLib = notfound
CopyCmApp = notfound
;
; Get Info from User
$IF (InstallType = serverInst)
 Choice = UserSelectMultiple(SelectPrompt, WantCm)
$Else
 Choice = UserSelectMultiple(SelectPrompt, WantRel, WantLib, WantCM)
$EndIf
CopyRelNote = SubString(WantRel, Choice) 
CopyMailLib = SubString(WantLib, Choice) 
CopyCmApp = SubString(WantCM, Choice)
$If (CopyCmApp < notfound)
 CMChoice = UserEnterValue(CMPrompt, CMConfigFile)
$EndIf
;
;	Check Operating System level
$If (OsRelease < 9) AND (OsRevision < 1)
 $DisplayLine(ErrOldOs)
 GoTo EndOfScript
$Else
 $If ((OsRelease = 9) AND (OsRevision >8)) OR (OsRelease > 10)
  ProcessRqs = true
 $EndIf
$EndIf
;
;	If this is a floppy install, set path
$If (InstallType = floppy)
 $Path,DeviceFrom, sys
$EndIf
;
;	Check to see if system has a local hard disk
$If Public OR (SystemType = clstrlfs) OR (SystemType = server)
 CopyLocal = true
$Else
 CopyLocal = false
$EndIf
;
;	Check to see if Mail Server etc commands should be installed.
;		Also set up partial file specs to be used for later LCopy commands.
$If Public OR (SystemType = server) OR (SystemType = stnd)
 AdminCmds = true
 DestTo = ServerSpec
 DefVol = '[Sys]'
$Else
 AdminCmds = false
 DestTo = LocalSpec
 DefVol = '[Sys]'
$EndIf
;
;	Create some space on the screen
$DisplayLine
$DisplayLine
$DisplayLine
$DisplayLine
;
;	Delete old Server run files
$If AdminCmds
 $Command Delete, '[sys]<sys>MailServerUtil.run'
 $Command Delete, '[sys]<sys>MailServer.run'
$EndIf
;   
;	Copy files from floppy.
$If (InstallType = floppy)
 $DisplayLine(FloppyMsg1)
 $If AdminCmds
  $AssignLocal NewDestTo, ConcatStrings(DestTo, '8.0>')
  $Command Rename,[sys]<sys>Request.8.sys,[sys]<sys>Request.z.sys,n
  $Command Rename,[sys]<sys>MailMenus.sys,[sys]<sys>7.0>MailMenus.sys,y
  $EchoOn
  $Run [sys]<sys>LCopy.run, @<sys>AdminInstall.files,,DestTo,,y
  $Run [sys]<sys>LCopy.run, <Unisys>MailCenter.config,,DestTo,,n
  $Run [sys]<sys>LCopy.run, <Unisys>MailCenter.config,,NewDestTo,,y
  $EchoOff
  $DeassignLocal(NewDestTo)
 $EndIf
 ;
 ;	Rename Request files locally.
 $If CopyLocal
  $Command Rename,[sys]<sys>Request.8.sys,[sys]<sys>Request.z.sys,n
  $EchoOn
  $Run [sys]<sys>LCopy.run, <Unisys>Request.8.txt,,[scr]<$>,,y
  $EchoOff
  $Command Rename,[sys]<sys>MailMenus.sys,[sys]<sys>7.0>MailMenus.sys,y
 $EndIf
 ;
 ;	Install Mail.Lib if specified.
 $IF (CopyMailLib < notfound)
  $EchoOn
  $Run [sys]<sys>Lcopy.run, <Lib>Mail.Lib,,DestTo,,y,,,y
  $EchoOff
 $EndIf
 ;
 $RestartLabel
 ;
 $NextFloppy(FloppySpec2)
 $DisplayLine
 $DisplayLine
 $DisplayLine
 $DisplayLine(FloppyMsg2)
 $EchoOn
 $Run [sys]<sys>LCopy.run, <Unisys>Mail.run,,DestTo,,y,,,y
 $EchoOff
 ;
 ;	Copy release notices.
 $IF (CopyRelNote < notfound)
  $NextFloppy(FloppySpec3)
  $DisplayLine
  $DisplayLine
  $DisplayLine
  $DisplayLine(FloppyMsg3)
  $EchoOn
  $Run [sys]<sys>Lcopy.run, <ReleaseNote>*,,DestTo,,y
  $EchoOff
 $EndIf
$EndIf
;
$RestartLabel
;
$If (InstallType = serverInst)
 $Display (ServerMsg)
 $EchoOn
 $Run [sys]<sys>LCopy.run, [sys]<sys>Mail.run,,[sys]<sys>,,y,,,y
 $Command Rename,[sys]<sys>Request.8.sys,[sys]<sys>Request.z.sys,n
 $Run [sys]<sys>LCopy.run, [sys]<sys>Request.8.sys,,[sys]<sys>,,y
 $Command Rename,[sys]<sys>MailMenus.sys,[sys]<sys>7.0>MailMenus.sys,y
 $EchoOff
 $DisplayLine (DoneMsg)
$EndIf
;
$RestartLabel
;
; Merge Request Files
;
$DisplayLine
$DisplayLine
$DisplayLine
;
$If ProcessRqs AND CopyLocal
 $Display (MergeMsg)
 ;
 ;  Build the Request.8.sys file if the text file copied from floppy.
 $If (InstallType = floppy)
  $If AdminCmds
   $Run [sys]<sys>MakeRqSet.run, [Scr]<$>Request.8.txt, 
     [sys]<sys>request.8.sys
  $Else
   $Run [sys]<sys>MakeRqSet.run, [Scr]<$>Request.8.txt, [sys]<sys>request.8.sys
  $Endif
 $Endif
 $If AdminCmds
  $Run [Sys]<sys>ListRqSet.run, ([Sys]<sys>Request?sys, 
    [sys]<sys>request.8.sys), [Scr]<$>Request.txt
  $Run [Sys]<sys>MakeRqSet.run, [Scr]<$>request.txt, [Sys]<sys>Request.sys
 $Else
  $Run [Sys]<sys>ListRqSet.run, ([Sys]<sys>Request?sys, 
    [sys]<sys>Request.8.sys), [Scr]<$>Request.txt
  $Run [Sys]<sys>MakeRqSet.run, [Scr]<$>Request.txt, [Sys]<sys>Request.sys
 $EndIf
 $DisplayLine (DoneMsg)
$EndIf
;
$RestartLabel
;
; Merge Mail Command File with user selected command file
$Display (CommandMsg)
$If AdminCmds
 $Command 'Remove Command', 'Deinstall Mail Server',[sys]<sys>sys.cmds
 $Command 'Remove Command', 'Install Mail Server',[sys]<sys>sys.cmds
 $Command 'Remove Command', 'Resume Mail Server',[sys]<sys>sys.cmds
 $Command 'Remove Command', 'Suspend Mail Server',[sys]<sys>sys.cmds
 CmdFileTo = '[Sys]<sys>Cluster.cmds'
 $Command 'Merge Command Files', CmdFileFrom, CmdFileTo, y, DefVol
 $Command 'Merge Command Files', CmdFileFrom, [sys]<sys>sys.cmds, y
$Else
 $Run ([Sys]<Sys>CmdFileEditor.run, 'New Command', 'AC'),
  Mail,[sys]<sys>Mail.run,,'Invokes the Interactive Mail Manager.',y,,,
$EndIf
$DisplayLine (DoneMsg)
;
; Add CM Application if specified by the user.
$If (CopyCMApp < notfound)
 $Run ([Sys]<Sys>cmConfigEditor.run, 'CM Add Application', '01'),
 CmChoice,Mail,[sys]<sys>Mail.run,250,'Mail',,,,,,,,,,y,,,
$EndIf
;
; Wrap up the installation
$Path, Sys, Sys
;
$PauseOn
;
EndOfScript:
;
$End
tallType = serverInst)
 Choice = UserSelectMultiple(SelectPrompt, WantCm)
$Else
 Choice = UserSelectMultiple(SelectPrompt, WantRel, WantLib, WantCM)
$EndIf
CopyRelNote = SubString(WantRel, Choice) 
CopyMailLib = SubString(WantLib, Choice) 
CopyCmApp = SubString(WantCM, Choice)
$If (CopyCmApp < notfound)
 CMChoice = UserEnterValue(CMPrompt, CMConfigFile)
$EndIf
;
;	Check Operating System level
$If (OsRelease < 