home *** CD-ROM | disk | FTP | other *** search
/ MGA Millennium Bulk / BLK_5_FEB_96.iso / os2 / uninstal.cmd < prev    next >
OS/2 REXX Batch file  |  1995-06-14  |  5KB  |  150 lines

  1. /********************************************************************/
  2. /********************************************************************/
  3.  
  4. '@echo off'
  5. say ''
  6. 'echo USE: "uninstal clean" to remove all MGA drivers from hard disk"'
  7. say ''
  8. 'echo press Ctrl+C to abort'
  9. 'pause'
  10.  
  11. CurDir=directory()
  12.  
  13. /********************************************************************/
  14. /* Seach for OS2 system path in PATH environement                   */
  15. /********************************************************************/
  16.  
  17. env = 'OS2ENVIRONMENT'
  18. Path = value('PATH',,env)
  19. if Path = '' then signal ENDSEARCH
  20.  
  21. ntmp = pos(':\OS2;', Path)
  22. if ntmp = 0 then signal ENDSEARCH
  23.  
  24. Dstdrv=substr(Path, ntmp-1,2)
  25.  
  26.  
  27. /*********************************************************************/
  28. /* remove any MGA statement from CONFIG.SYS                          */
  29. /*********************************************************************/
  30.  
  31. NewDir=directory(Dstdrv'\')             /* go to root off OS/2 drive */
  32. InnF=Dstdrv'\CONFIG.MGA'
  33. OutF=Dstdrv'\CONFIG.SYS'
  34. 'copy 'OutF' 'InnF' >nul'
  35. 'del 'OutF
  36.  
  37. do until lines(InnF) = 0
  38.     InStr = linein(InnF)
  39.     select
  40.         when pos('MGAKRNL.SYS', InStr) > 0  then nop    /* Terminator       */
  41.         when pos('MGA=', InStr) > 0         then nop    /* Termin / Millen  */
  42.         when pos('MGARES=', InStr) > 0      then nop    /* Terminator < 2.0 */
  43.         when pos('VIO_MGA', InStr) > 0      then nop    /* Termin / Millen  */
  44.         when pos('RAMBIOS.SYS', InStr) > 0  then nop    /* Terminator < 2.0 */
  45.         when pos('VMGA.SYS', InStr) > 0     then nop    /* Terminator       */
  46.         when pos('KMGAX64.SYS', InStr) > 0  then nop    /* Millennium       */
  47.         when pos('VMGAX64.SYS', InStr) > 0  then nop    /* Millennium       */
  48.         otherwise
  49.         do
  50.             if pos('LIBPATH=', InStr) > 0   then        do
  51.                 itmp = pos(':\MGA\OS', InStr)
  52.                 if itmp > 0 then stmp=delstr(InStr, itmp-1, 11)
  53.                 else stmp=InStr
  54.                 call lineout OutF, stmp
  55.             end
  56.             else do
  57.                 itmp = pos(':\MGA\OS2', InStr)
  58.                 if itmp = 0 then  call lineout OutF, InStr
  59.                 end
  60.         end
  61.     end
  62. end
  63.  
  64. call stream OutF, 'c', 'close'
  65. call stream InnF, 'c', 'close'
  66. 'del 'InnF
  67.  
  68. /**********************************/
  69. /* remove MGAs from  AUTOEXEC.BAT */
  70. /**********************************/
  71.  
  72. 'call 'Dstdrv'\MGA\OS2\FIXAUTO.CMD 'Dstdrv' OFF'
  73.  
  74. call rxfuncadd sysloadfuncs, rexxutil, sysloadfuncs
  75. call sysloadfuncs
  76. ver = SysOS2Ver()
  77.  
  78. /********************************************************************/
  79. /* Get arguments if any                                             */
  80. /********************************************************************/
  81.  
  82. Parse Arg all
  83. If words(all) = 1 then OPTION = translate(word(all,1))
  84. if OPTION \= 'CLEAN' then signal Finished
  85.  
  86. /********************************************************************/
  87. /* Seach for WinOS2 path in OS2.INI                                 */
  88. /********************************************************************/
  89.  
  90. Windrv=Dstdrv                           /* default value */
  91. WinDir=Windrv'\OS2\MDOS\WINOS2'         /* default value */
  92. FoundWindir=0                           /* not found yet */
  93.  
  94. IniFile='USER'
  95. Apps='PM_INSTALL'
  96. AppsKeys='WINOS2_LOCATION'
  97.  
  98. call SysIni IniFile, Apps, AppsKeys
  99. if Result \= 'ERROR:' then
  100. do
  101.     val = SysIni(IniFile, Apps, AppsKeys)
  102.     NewDir=directory(val)
  103.     if NewDir\= '' then do
  104.         WinDir=NewDir
  105.         Windrv=Left(WinDir,2)
  106.         FoundWindir=1                       /* found it     */
  107.     end
  108. end
  109.  
  110. NewDir=directory(Dstdrv'\MGA\OS2')
  111. 'if exist syslevel.mga del syslevel.mil'
  112. 'if exist uninstal.cmd del uninstal.cmd'
  113. 'if exist mgaconf.cmd  del mgaconf.cmd'
  114. 'if exist fixauto.cmd  del fixauto.cmd'
  115. 'if exist mgax64s.dsp  del mgax64s.dsp'
  116. 'if exist rambios.sys  del rambios.sys'
  117. 'if exist KMGAX64.SYS  del KMGAX64.SYS'
  118. NewDir=directory(Dstdrv'\OS2\DLL')
  119. 'if exist pmgax64.dll  del pmgax64.dll'
  120. 'if exist bmgax64.dll  del bmgax64.dll'
  121. NewDir=directory(Dstdrv'\OS2\MDOS')
  122. 'if exist vmga.sys del VMGAX64.SYS'
  123.  
  124. if FoundWindir=0 then signal Finished
  125.  
  126. NewDir=directory(WinDir'\SYSTEM')
  127. 'if exist smgax64.drv  del smgax64.drv'
  128. 'if exist mgax64.dll   del mgax64.dll'
  129. NewDir=directory(Dstdrv'\OS2\MDOS\WINJOS2\SYSTEM')
  130. 'if exist smgax64.drv  del smgax64.drv'
  131. 'if exist mgax64.dll   del mgax64.dll'
  132.  
  133. Finished:
  134. call directory CurDir
  135.  
  136. say ''
  137. say 'FINISH'
  138. say ''
  139. say 'RUN DSPINSTL ?'
  140. 'echo press Ctrl+C to abort'
  141. 'pause'
  142. NewDir=directory(Dstdrv'\OS2\INSTALL')      /* go to root off OS/2 drive    */
  143. 'DSPINSTL.EXE'                              /* install other display driver */
  144.  
  145. call directory CurDir
  146. exit
  147.  
  148. ENDSEARCH:
  149. say 'Can not locate OS/2 System drive'
  150.