home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1998 January (DVD) / VPR980100.ISO / K / MILLEN / OS2_J / UNINSTAL.CMD < prev   
OS/2 REXX Batch file  |  1996-12-15  |  8KB  |  213 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. /* Search 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. /* remove any MGA statement from CONFIG.SYS                          */
  28. /*********************************************************************/
  29.  
  30. NewDir=directory(Dstdrv'\')             /* go to root off OS/2 drive */
  31. InnF=Dstdrv'\CONFIG.MGA'
  32. OutF=Dstdrv'\CONFIG.SYS'
  33. 'copy 'OutF' 'InnF' >nul'
  34. 'del 'OutF
  35.  
  36. do until lines(InnF) = 0
  37.     InStr = linein(InnF)
  38.     select
  39.         when pos('MGAKRNL.SYS', InStr) > 0  then nop    /* Terminator       */
  40.         when pos('MGA=', InStr) > 0         then nop    /* Termin / Millen  */
  41.         when pos('MGARES=', InStr) > 0      then nop    /* Terminator < 2.0 */
  42.         when pos('VIO_MGA', InStr) > 0      then nop    /* Termin / Millen  */
  43.         when pos('RAMBIOS.SYS', InStr) > 0  then nop    /* Terminator < 2.0 */
  44.         when pos('VMGA.SYS', InStr) > 0     then nop    /* Terminator       */
  45.         when pos('KMGAX64.SYS', InStr) > 0  then nop    /* Millennium       */
  46.         when pos('VMGAX64.SYS', InStr) > 0  then nop    /* Millennium       */
  47.         otherwise
  48.         do
  49.             if pos('LIBPATH=', InStr) > 0   then        do
  50.                 itmp = pos(':\MGA\OS', InStr)
  51.                 if itmp > 0 then stmp=delstr(InStr, itmp-1, 11)
  52.                 else stmp=InStr
  53.                 call lineout OutF, stmp
  54.             end
  55.             else do
  56.                 itmp = pos(':\MGA\OS2', InStr)
  57.                 if itmp = 0 then  call lineout OutF, InStr
  58.                 end
  59.         end
  60.     end
  61. end
  62.  
  63. call stream OutF, 'c', 'close'
  64. call stream InnF, 'c', 'close'
  65. 'del 'InnF
  66.  
  67. /**********************************/
  68. /* remove MGAs from  AUTOEXEC.BAT */
  69. /**********************************/
  70.  
  71. 'call 'Dstdrv'\MGA\OS2\FIXAUTO.CMD 'Dstdrv' OFF'
  72.  
  73. call rxfuncadd sysloadfuncs, rexxutil, sysloadfuncs
  74. call sysloadfuncs
  75. ver = SysOS2Ver()
  76.  
  77. /************************************/
  78. /* remove MGAHK from Startup folder */
  79. /************************************/
  80.  
  81. Result = SysDestroyObject('<MGAHK>')
  82.  
  83. /************************************/
  84. /* remove default font setting      */
  85. /************************************/
  86.  
  87. Result = SysIni('USER', 'PM_SystemFonts', 'DefaultFont', 'DELETE:')
  88.  
  89. /********************************************************************/
  90. /* Get arguments if any                                             */
  91. /********************************************************************/
  92.  
  93. Parse Arg all
  94. If words(all) = 1 then OPTION = translate(word(all,1))
  95. if OPTION \= 'CLEAN' then signal Finished
  96.  
  97. /********************************************************************/
  98. /* Search for WinOS2 path in OS2.INI                                */
  99. /********************************************************************/
  100.  
  101. Windrv=Dstdrv                           /* default value */
  102. WinDir=Windrv'\OS2\MDOS\WINOS2'         /* default value */
  103. FoundWindir=0                           /* not found yet */
  104.  
  105. IniFile='USER'
  106. Apps='PM_INSTALL'
  107. AppsKeys='WINOS2_LOCATION'
  108.  
  109. call SysIni IniFile, Apps, AppsKeys
  110. if Result \= 'ERROR:' then
  111. do
  112.     val = SysIni(IniFile, Apps, AppsKeys)
  113.     NewDir=directory(val)
  114.     if NewDir\= '' then do
  115.         WinDir=NewDir
  116.         Windrv=Left(WinDir,2)
  117.         FoundWindir=1                       /* found it     */
  118.     end
  119. end
  120.  
  121. NewDir=directory(Dstdrv'\MGA\OS2')
  122. 'if exist syslevel.mga del syslevel.mga'
  123. 'if exist uninstal.cmd del uninstal.cmd'
  124. 'if exist mgaconf.cmd  del mgaconf.cmd'
  125. 'if exist fixauto.cmd  del fixauto.cmd'
  126. 'if exist mgax64s.dsp  del mgax64s.dsp'
  127. 'if exist rambios.sys  del rambios.sys'
  128. 'if exist KMGAX64.SYS  del KMGAX64.SYS'
  129. 'if exist mgaset.exe   del mgaset.exe'
  130. 'if exist mgaset.dll   del mgaset.dll'
  131. 'if exist mgaset.hlp   del mgaset.hlp'
  132. 'if exist mgahk.exe    del mgahk.exe'
  133. 'if exist vvga.sys     del vvga.sys'
  134. 'if exist readme.os2   del readme.os2'
  135. 'if exist mga.mon      del mga.mon'
  136. 'if exist mgaobj.cmd   del mgaobj.cmd'
  137. 'if exist mga.inf      del mga.inf'
  138. 'if exist mga.ddc      del mga.ddc'
  139.  
  140. NewDir = directory(Dstdrv'..')
  141. 'rd os2 2>nul'
  142. NewDir = directory(Dstdrv'..')
  143. 'rd mga 2>nul'
  144.  
  145. Result = SysDestroyObject('<MGASET>')
  146.  
  147. Result = SysIni('USER', 'MGA32',                      'DELETE:')
  148. Result = SysIni('USER', 'WIN_RES_MGAX64_SMALL',       'DELETE:')
  149. Result = SysIni('USER', 'WIN_RES_MGAX64_LARGE',       'DELETE:')
  150. Result = SysIni('USER', 'WIN_RES_UNKNOWN',            'DELETE:')
  151. Result = SysIni('USER', 'WIN_RES_640x480x256',        'DELETE:')
  152. Result = SysIni('USER', 'WIN_RES_640x480x65536',      'DELETE:')
  153. Result = SysIni('USER', 'WIN_RES_640x480x16777216',   'DELETE:')
  154. Result = SysIni('USER', 'WIN_RES_800x600x256',        'DELETE:')
  155. Result = SysIni('USER', 'WIN_RES_800x600x65536',      'DELETE:')
  156. Result = SysIni('USER', 'WIN_RES_800x600x16777216',   'DELETE:')
  157. Result = SysIni('USER', 'WIN_RES_1024x768x256',       'DELETE:')
  158. Result = SysIni('USER', 'WIN_RES_1024x768x65536',     'DELETE:')
  159. Result = SysIni('USER', 'WIN_RES_1024x768x16777216',  'DELETE:')
  160. Result = SysIni('USER', 'WIN_RES_1152x864x256',       'DELETE:')
  161. Result = SysIni('USER', 'WIN_RES_1152x864x65536',     'DELETE:')
  162. Result = SysIni('USER', 'WIN_RES_1152x864x16777216',  'DELETE:')
  163. Result = SysIni('USER', 'WIN_RES_1280x1024x256',      'DELETE:')
  164. Result = SysIni('USER', 'WIN_RES_1280x1024x65536',    'DELETE:')
  165. Result = SysIni('USER', 'WIN_RES_1280x1024x16777216', 'DELETE:')
  166. Result = SysIni('USER', 'WIN_RES_1600x1200x256',      'DELETE:')
  167. Result = SysIni('USER', 'WIN_RES_1600x1200x65536',    'DELETE:')
  168. Result = SysIni('USER', 'WIN_RES_1600x1200x16777216', 'DELETE:')
  169. Result = SysIni('USER', 'WIN_RES_1600x1280x256',      'DELETE:')
  170. Result = SysIni('USER', 'WIN_RES_1600x1280x65536',    'DELETE:')
  171. Result = SysIni('USER', 'WIN_RES_1600x1280x16777216', 'DELETE:')
  172. Result = SysIni('USER', 'WIN_RES_1800x1440x256',      'DELETE:')
  173. Result = SysIni('USER', 'WIN_RES_1800x1440x65536',    'DELETE:')
  174. Result = SysIni('USER', 'WIN_RES_1800x1440x16777216', 'DELETE:')
  175. Result = SysIni('USER', 'PM_DISPLAYDRIVERS', 'DEFAULTDRIVER',           'DELETE:')
  176. Result = SysIni('USER', 'PM_DISPLAYDRIVERS', 'DEFAULTSYSTEMRESOLUTION', 'DELETE:')
  177. Result = SysIni('USER', 'PM_DISPLAYDRIVERS', 'PMGAX64',                 'DELETE:')
  178. Result = SysIni('USER', 'PM_DISPLAYDRIVERS', 'RESOLUTION_CHANGED',      'DELETE:')
  179.  
  180. NewDir=directory(Dstdrv'\OS2\DLL')
  181. 'if exist pmgax64.dll  del pmgax64.dll'
  182. 'if exist bmgax64.dll  del bmgax64.dll'
  183. NewDir=directory(Dstdrv'\OS2\MDOS')
  184. 'if exist vmga.sys del VMGAX64.SYS'
  185.  
  186. if FoundWindir=0 then signal Finished
  187.  
  188. NewDir=directory(WinDir'\SYSTEM')
  189. 'if exist smgax64.drv  del smgax64.drv'
  190. 'if exist mgax64.dll   del mgax64.dll'
  191. /* NewDir=directory(Dstdrv'\OS2\MDOS\WINJOS2\SYSTEM') */
  192. 'if exist 'Dstdrv'\os2\mdos\winjos2 cd \os2\mdos\winjos2\system'
  193. 'if exist smgax64.drv  del smgax64.drv'
  194. 'if exist mgax64.dll   del mgax64.dll'
  195.  
  196. Finished:
  197. call directory CurDir
  198.  
  199. say ''
  200. say 'MGA driver uninstalled.'
  201. say ''
  202. /* say 'RUN DSPINSTL?' */
  203. 'echo Press Ctrl+C to end or another key to run DSPINSTL.'
  204. 'pause'
  205. NewDir=directory(Dstdrv'\OS2\INSTALL')      /* go to root off OS/2 drive    */
  206. 'DSPINSTL.EXE'                              /* install other display driver */
  207.  
  208. call directory CurDir
  209. exit
  210.  
  211. ENDSEARCH:
  212. say 'Cannot locate OS/2 System drive'
  213.