/* */

call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
call SysLoadFuncs
call SysCls
PMMPEGPATH = DIRECTORY()
parse upper arg srcdisk dstdisk .

parse source . . command .

path = FILESPEC( 'path', command )
   path = substr( path, 1, length(path) - 1 )
   path = translate( path )
Drive = FILESPEC( 'drive', command )

'@ 'Drive
'@cd 'path

bksrc.1 = 'MDOS\VSVGA.SYS'
bksrc.2 = 'MDOS\VVGA.SYS'
bksrc.3 = 'SVGA.EXE'
bksrc.4 = 'SCREEN01.SYS'
bksrc.5 = 'SCREEN02.SYS'
bksrc.6 = 'DLL\IBMGPMI.DLL'
bksrc.7 = 'DLL\IBMDEV32.DLL'
bksrc.8 = 'DLL\IBMVGA32.DLL'
bksrc.9 = 'DLL\BVHVGA.DLL'
bksrc.10 = 'DLL\BVHSVGA.DLL'

bksrc.0 = 10

bkdst.1 = 'VSVGA.SYS'
bkdst.2 = 'VVGA.SYS'
bkdst.3 = 'SVGA.EXE'
bkdst.4 = 'SCREEN01.SYS'
bkdst.5 = 'SCREEN02.SYS'
bkdst.6 = 'IBMGPMI.DLL'
bkdst.7 = 'IBMDEV32.DLL'
bkdst.8 = 'IBMVGA32.DLL'
bkdst.9 = 'BVHVGA.DLL'
bkdst.10 = 'BVHSVGA.DLL'

say d2c(27)'[1;40;32m' 
say '* Avance Logic, Inc.'
say '*'
say '* OS/2 Support Files Installation...'
say '*'
say '* You are about to begin installation of driver support files.'
say '*'d2c(27)'[1;40;36m'
'@pause'
say '*'d2c(27)'[1;40;37m'

Call SysFileTree 'C:\OS2\MDOS\AVANCEBK',dirs,'DO'
if dirs.0 = 0 then
  do
      '@MD C:\OS2\MDOS\AVANCEBK >NUL'
      say 'Backup Files'd2c(27)'[1;40;33m'
      do i = 1 to bksrc.0
         say 'C:\OS2\'bksrc.i
         '@COPY C:\OS2\'bksrc.i' C:\OS2\MDOS\AVANCEBK\'bkdst.i' >NUL'
      end
  end
Call SysFileTree 'C:\OS2\MDOS\AVANCEBK\ALIDRV',dirs,'DO'
if dirs.0 = 0 then
  do
      '@MD C:\OS2\MDOS\AVANCEBK\ALIDRV >NUL'
      call CopyDrv Drive, path
  end
Call SysFileTree 'C:\OS2\MDOS\AVANCEBK\ALIDRV\svga.exe',file,'F'
if file.0 = 0 then
      call CopyDrv Drive, path
else
   Do
      '@dir C:\OS2\MDOS\AVANCEBK\ALIDRV\svga.exe | find "4-03-95" >nul'
      if rc <> 0 then call CopyDrv Drive, path
   End
call setup.cmd
Return


CopyDrv: Procedure
 Parse Arg Drive,path
      say '*'d2c(27)'[1;40;32m'
      Call SysFileTree '.\*.*',files,'F'
      do i = 1 to files.0
         files.i = FILESPEC( 'name', files.i )
         say Drive''path'\'files.i
         '@COPY 'files.i' C:\OS2\MDOS\AVANCEBK\ALIDRV\'files.i' >NUL'
      end
      if SysCreateObject("WPProgram","Avance Display Install","<WP_DESKTOP>",255,
                           "PROGTYPE=PM;EXENAME==C:\OS2\MDOS\AVANCEBK\ALIDRV\SETUP.CMD;STARTUPDIR=C:\OS2\MDOS\AVANCEBK\ALIDRV;ASSOCFILTER=setup.ico")
      then
        say
Return
