SaveVidLevel = VideoLevel
EchoOff

; pServerOs>Install.jcl
; Install the ProtectedMode Server Operating System subpackage

; Public installation is allowed for two reasons:
;    Headless servers (ala BULL)
;    Creation of a new server from an existing one.
;    pSrvr.img is copied to [Sys]<Sys> and maybe [Sys]<Sys>SysImage.sys.

; Except for yesno strings  'First disk message' the following is the only 
; nationalizable string in this file.
ErrorMsg     = 'Cannot access pServerOs>InstallMsg.bin'

FromFloppy   = 0
FromServer   = 2
TotalNoise   = 0
TotalSilence = 2
FloppyType   = 0
Floppy5Qtr   = 1
Floppy3Half  = 4
NotFound     = 65535
ClearScreen  = 'PF'
If SaveVidLevel = TotalNoise
   Display(ClearScreen)
EndIf

If InstallType = FromFloppy
   FloppyType   = DeviceType(DeviceFrom)
EndIf

; The following message is nationalizable
If FloppyType = Floppy5Qtr
   FirstDisk    = 'Protected Mode OS Diskette 1 of 4 (B25P341)'
Else
   If FloppyType = Floppy3Half
      FirstDisk   = 'Protected Mode OS Diskette 2 of 2 (B25P342)'
   EndIf
EndIf

If InstallType = FromFloppy
   NextFloppy(FirstDisk)
EndIf

ServerSpec   = ConcatStrings(DeviceFrom, DirectoryTo)
FloppySpec   = ConcatStrings(DeviceFrom, '<CTOS>')
ToSpec       = ConcatStrings(VolumeTo, DirectoryTo)
PrivateOsTo  = ConcatStrings(ToSpec, 'SysImage.sys')
EtcFromSpec  = ConcatStrings(DeviceFrom, '<OsInstall>')
OsName       = 'pSrvr.img'
ConfigFile   = 'Config.sys'
NlsKbdFile   = 'NlsKbd.sys'


InitErc = InitMsgFile(MsgFile)
If InitErc <> 0
   DisplayLine(ErrorMsg)
   Cancel
EndIf

If InstallType = FromServer
   Display(ClearScreen)
   Msg = GetMsg(4)
   DisplayLine(Msg)
   Msg = GetMsg(5)
   DisplayLine(Msg)
   Msg = GetMsg(6)
   Confirmed = UserSelectYesNo(Msg, 'Yes')
   If Not Confirmed
      GoTo ChkPkgs
   EndIf
EndIf

Display(ClearScreen)

If Public
   Display(ClearScreen)
   Msg = GetMsg(7)
   OverwriteSys = UserSelectYesNo(Msg, 'Yes')
EndIf

If InstallType = FromServer
   OsFromServer = ConcatStrings(ServerSpec, OsName)
   If SaveVidLevel = TotalNoise
      EchoSome
   EndIf
   DisplayLine
   Command LCopy           ,
                           ,
              OsFromServer ,
              PrivateOsTo  ,
                           ,
              Yes          ,
              No           ,
              No           ,
              Yes
   DisplayLine
   Command LCopy         ,
              ConfigFile ,
              ServerSpec ,
              ToSpec     ,
                         ,
              No         ,
              No         ,
              No         ,
              Yes
   Msg = GetMsg(10)
   ConfigSpec = ConcatStrings(ToSpec, Msg)
   DisplayLine
   Command LCopy         ,
              ConfigFile ,
              ServerSpec ,
              ConfigSpec ,
                         ,
              Yes        ,
              No         ,
              No         ,
              Yes
   FileName = ConcatStrings(ToSpec, NlsKbdFile)
   Ver = FileVersion(FileName)
   If Ver <> '0'
      Msg = GetMsg(9)
      SaveSpec = ConcatStrings(ToSpec, Msg)
      FileName = ConcatStrings(SaveSpec, NlsKbdFile)
      Ver = FileVersion(FileName)
      If Ver = '0'
         DisplayLine
         Command LCopy         ,
                    NlsKbdFile ,
                    ToSpec     ,
                    SaveSpec   ,
                               ,
                    No         ,
                    No         ,
                    No         ,
                    Yes
         DisplayLine
         Msg = ConcatStrings(ToSpec, NlsKbdFile)
         Display(Msg)
         Msg = GetMsg(8)
         Display(Msg)
         Display(ToSpec)
         Msg = GetMsg(9)
         Display(Msg)
         DisplayLine(NlsKbdFile)
      EndIf
   EndIf
   DisplayLine
   Command LCopy         ,
              NlsKbdFile ,
              ServerSpec ,
              ToSpec     ,
                         ,
              Yes        ,
              No         ,
              No         ,
              Yes
   If SaveVidLevel = TotalNoise
      EchoOff
   EndIf
   GoTo ChkPkgs
EndIf

If SaveVidLevel = TotalNoise
   EchoSome
EndIf
DisplayLine
Command LCopy          ,
           ConfigFile  ,
           EtcFromSpec ,
           ToSpec      ,
                       ,
           No          ,
           No          ,
           No          ,
           Yes
Msg = GetMsg(10)
ConfigSpec = ConcatStrings(ToSpec, Msg)
DisplayLine
Command LCopy          ,
           ConfigFile  ,
           EtcFromSpec ,
           ConfigSpec  ,
                       ,
           Yes         ,
           No          ,
           No          ,
           Yes
FileName = ConcatStrings(ToSpec, NlsKbdFile)
Ver = FileVersion(FileName)
If Ver <> '0'
   Msg = GetMsg(9)
   SaveSpec = ConcatStrings(ToSpec, Msg)
   FileName = ConcatStrings(SaveSpec, NlsKbdFile)
   Ver = FileVersion(FileName)
   If Ver = '0'
      DisplayLine
      Command LCopy         ,
                 NlsKbdFile ,
                 ToSpec     ,
                 SaveSpec   ,
                            ,
                 No         ,
                 No         ,
                 No         ,
                 Yes
      DisplayLine
      Msg = ConcatStrings(ToSpec, NlsKbdFile)
      Display(Msg)
      Msg = GetMsg(8)
      Display(Msg)
      Display(ToSpec)
      Msg = GetMsg(9)
      Display(Msg)
      DisplayLine(NlsKbdFile)
   EndIf
EndIf
DisplayLine
Command LCopy          ,
           NlsKbdFile  ,
           EtcFromSpec ,
           ToSpec      ,
                       ,
           Yes         ,
           No          ,
           No          ,
           Yes
If SaveVidLevel = TotalNoise
   EchoOff
EndIf

If FloppyType = Floppy5Qtr
   Diskette = GetMsg(1)
EndIf

If FloppyType = Floppy5Qtr
   NextFloppy(Diskette)
   DisplayLine
EndIf

OsFrom = ConcatStrings(FloppySpec, OsName)

If Public
   OsTo = ConcatStrings(ToSpec, OsName)
Else
   OsTo = PrivateOsTo
EndIf

If SaveVidLevel = TotalNoise
   EchoSome
EndIf
DisplayLine
Command LCopy     ,
                  ,
           OsFrom ,
           OsTo   ,
                  ,
           Yes    ,
           No     ,
           No     ,
           Yes
If SaveVidLevel = TotalNoise
   EchoOff
EndIf

If Public
   If OverwriteSys
      If SaveVidLevel = TotalNoise
         EchoSome
      EndIf
      DisplayLine
      Command LCopy          ,
                             ,
                 OsFrom      ,
                 PrivateOsTo ,
                             ,
                 Yes         ,
                 No          ,
                 No          ,
                 Yes
      If SaveVidLevel = TotalNoise
         EchoOff
      EndIf
   EndIf
EndIf

ChkPkgs:
DisplayLine

;Next SubPackage:	pDebugger 
Pkg = GetMsg(3)
If SubString(Pkg, Pkgs) <> NotFound
   If FloppyType = Floppy5Qtr   
      Diskette = GetMsg(2)
      NextFloppy(Diskette)
   EndIf
   GoTo EndIt
EndIf

EndIt:

End
