SaveVidLevel = VideoLevel
EchoOff

; vStndOs>Install.jcl
; Install the VirtualMode StandAlone Operating System subpackage

; Public installation is allowed for two reasons:
; vStnd.img is copied to [Sys]<Sys> and but NOT to [Sys]<Sys>SysImage.sys.

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

FromCD       = 5
FromFloppy   = 0
FromServer   = 2
FloppyType   = 0
Floppy5Qtr   = 1
Floppy3Half  = 4
NotFound     = 6553
TotalNoise   = 0
ClearScreen  = 'PF'

If InstallType = FromFloppy
   FloppyType   = DeviceType(DeviceFrom)
EndIf

; The following message is nationalizable
If FloppyType    = Floppy5Qtr
   FirstDisk     = 'Virtual Mode OS Diskette 4 of 6 (B25V1046)'
Else
   If FloppyType = Floppy3Half
      FirstDisk  = 'Virtual Mode OS Diskette 2 of 3 (B25V1023)'
   EndIf
EndIf
ServerSpec   = ConcatStrings(DeviceFrom, DirectoryTo)
FloppySpec   = ConcatStrings(DeviceFrom, '<CTOS>')
ToSpec       = ConcatStrings(VolumeTo, DirectoryTo)
PrivateOsTo  = ConcatStrings(ToSpec, 'SysImage.sys')
EtcFromSpec  = ConcatStrings(DeviceFrom, '<OsInstall>')
OsName       = 'vStnd.img'
ConfigFile   = 'Config.sys'
NlsKbdFile   = 'NlsKbd.sys'
OtherFiles   = ConcatStrings(EtcFromSpec, 'StndCopy.fls')
OsFrom       = ConcatStrings(FloppySpec, OsName)

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

Display(ClearScreen)
Msg = GetMsg(10)
OverwriteSys = UserSelectYesNo(Msg, 'Yes')

If InstallType = FromServer
   OsFromServer = ConcatStrings(ServerSpec, OsName)
   DisplayLine
   If SaveVidLevel = TotalNoise
      EchoSome
   EndIf
   Command LCopy                                      ,
                                                      ,
             @[Scr]<$>InstallOverwriteOkFrom.fls      ,
             @[Scr]<$>InstallOverwriteOkTo.fls        ,
                                                      ,
             Yes                                      ,
             No                                       ,
             No                                       ,
             Yes
   DisplayLine
   Command LCopy           ,
              OsFromServer ,
                           ,
              ToSpec       ,
                           ,
              Yes          ,
              No           ,
              No           ,
              Yes
   DisplayLine
   Command LCopy         ,
              ConfigFile ,
              ServerSpec ,
              ToSpec     ,
                         ,
              No         ,
              No         ,
              No         ,
              Yes
   If OverwriteSys
       Command LCopy       ,
                           ,
              OsFromServer ,
              PrivateOsTo  ,
                           ,
              Yes          ,
              No           ,
              No           ,
              Yes
   EndIf
   If SaveVidLevel = TotalNoise
      EchoOff
   EndIf
   Msg = GetMsg(9)
   ConfigSpec = ConcatStrings(ToSpec, Msg)
   DisplayLine
   If SaveVidLevel = TotalNoise
      EchoSome
   EndIf
   Command LCopy         ,
              ConfigFile ,
              ServerSpec ,
              ConfigSpec ,
                         ,
              Yes        ,
              No         ,
              No         ,
              Yes
   If SaveVidLevel = TotalNoise
      EchoOff
   EndIf
   FileName = ConcatStrings(ToSpec, NlsKbdFile)
   Ver = FileVersion(FileName)
   If Ver <> '0'
      Msg = GetMsg(8)
      SaveSpec = ConcatStrings(ToSpec, Msg)
      FileName = ConcatStrings(SaveSpec, NlsKbdFile)
      Ver = FileVersion(FileName)
      If Ver = '0'
         DisplayLine
         If SaveVidLevel = TotalNoise
            EchoSome
         EndIf
         Command LCopy         ,
                    NlsKbdFile ,
                    ToSpec     ,
                    SaveSpec   ,
                               ,
                    No         ,
                    No         ,
                    No         ,
                    Yes
         If SaveVidLevel = TotalNoise
            EchoOff
         EndIf
         DisplayLine
         Msg = ConcatStrings(ToSpec, NlsKbdFile)
         Display(Msg)
         Msg = GetMsg(7)
         Display(Msg)
         Display(ToSpec)
         Msg = GetMsg(8)
         Display(Msg)
         DisplayLine(NlsKbdFile)
      EndIf
   EndIf
   DisplayLine
   If SaveVidLevel = TotalNoise
      EchoSome
   EndIf
   Command LCopy         ,
              NlsKbdFile ,
              ServerSpec ,
              ToSpec     ,
                         ,
              Yes        ,
              No         ,
              No         ,
              Yes
   If SaveVidLevel = TotalNoise
      EchoOff
   EndIf
   GoTo ChkPkgs
EndIf

; ********  INSTALL FROM FLOPPY....******************

If InstallType = FromFloppy
  NextFloppy(FirstDisk)


  If FloppyType = Floppy3Half

    If SaveVidLevel = TotalNoise
        EchoSome
    EndIf
    DisplayLine
    Command LCopy      ,
           ConfigFile  ,
           EtcFromSpec ,
           ToSpec      ,
                       ,
           No          ,
           No          ,
           No          ,
           Yes

    If SaveVidLevel = TotalNoise
        EchoOff
    EndIf
    Msg = GetMsg(9)
    ConfigSpec = ConcatStrings(ToSpec, Msg)
    DisplayLine

    If SaveVidLevel = TotalNoise
        EchoSome
    EndIf
    Command LCopy      ,
           ConfigFile  ,
           EtcFromSpec ,
           ConfigSpec  ,
                       ,
           Yes         ,
           No          ,
           No          ,
           Yes
    If SaveVidLevel = TotalNoise
        EchoOff
    EndIf

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

    If SaveVidLevel = TotalNoise
          EchoSome
    EndIf
    Command LCopy          ,
               NlsKbdFile  ,
               EtcFromSpec ,
               ToSpec      ,
                           ,
               Yes         ,
               No          ,
               No          ,
               Yes
    DisplayLine
    Command LCopy          ,
              @OtherFiles  ,
              EtcFromSpec  ,
              ToSpec       ,
                           ,
              Yes          ,
              No           ,
              No           ,
              Yes

    DisplayLine

    DisplayLine
    Command LCopy          ,
               OsFrom      ,
                           ,
               ToSpec      ,
                           ,
               Yes         ,
               No          ,
               No          ,
               Yes
    DisplayLine
    If OverwriteSys
       Command LCopy       ,
                           ,
              OsFrom       ,
              PrivateOsTo  ,
                           ,
              Yes          ,
              No           ,
              No           ,
              Yes
    EndIf

    If SaveVidLevel = TotalNoise
          EchoOff
    EndIf

  EndIf

;       ****** End 3 install... Start 5 *******

  If FloppyType = Floppy5Qtr
    DisplayLine
    If SaveVidLevel = TotalNoise
          EchoSome
    EndIf
    Command LCopy      ,
           ConfigFile  ,
           EtcFromSpec ,
           ToSpec      ,
                       ,
           No          ,
           No          ,
           No          ,
           Yes

    If SaveVidLevel = TotalNoise
          EchoOff
    EndIf
    Msg = GetMsg(9)
    ConfigSpec = ConcatStrings(ToSpec, Msg)
    DisplayLine

    If SaveVidLevel = TotalNoise
          EchoSome
    EndIf
    Command LCopy      ,
           ConfigFile  ,
           EtcFromSpec ,
           ConfigSpec  ,
                       ,
           Yes         ,
           No          ,
           No          ,
           Yes
    If SaveVidLevel = TotalNoise
          EchoOff
    EndIf

    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
          If SaveVidLevel = TotalNoise
              EchoSome
          EndIf
          Command LCopy         ,
                     NlsKbdFile ,
                     ToSpec     ,
                     SaveSpec   ,
                                ,
                     No         ,
                     No         ,
                     No         ,
                     Yes
          If SaveVidLevel = TotalNoise
              EchoOff
          EndIf
          DisplayLine
          Msg = ConcatStrings(ToSpec, NlsKbdFile)
          Display(Msg)
          Msg = GetMsg(7)
          Display(Msg)
          Display(ToSpec)
          Msg = GetMsg(9)
          Display(Msg)
          DisplayLine(NlsKbdFile)
       EndIf
    EndIf

    If SaveVidLevel = TotalNoise
        EchoSome
    EndIf
    Command LCopy          ,
               NlsKbdFile  ,
               EtcFromSpec ,
               ToSpec      ,
                           ,
               Yes         ,
               No          ,
               No          ,
               Yes
    DisplayLine
    Command LCopy          ,
              @OtherFiles  ,
              EtcFromSpec  ,
              ToSpec       ,
                           ,
              Yes          ,
              No           ,
              No           ,
              Yes
    If SaveVidLevel = TotalNoise
        EchoOff
    EndIf

    DisplayLine
    Diskette = GetMsg(2)
    NextFloppy(Diskette)

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

    If SaveVidLevel = TotalNoise
        EchoOff
    EndIf

    DisplayLine

  EndIf ;   ****** End  5 *******

EndIf; *** End FromFloppy ***

ChkPkgs:
DisplayLine

;Next SubPackage:    vDebugger 
Pkg = GetMsg(3)
If SubString(Pkg, Pkgs) <> NotFound
   If FloppyType = Floppy5Qtr
      Diskette = GetMsg(4)
      NextFloppy(Diskette)
   Else
      If FloppyType = Floppy3Half
         Diskette = GetMsg(6)
         NextFloppy(Diskette)
      EndIf
   EndIf
   GoTo EndIt
EndIf

EndIt:
End
