home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / wtun0612.zip / uninstl.cmd < prev    next >
OS/2 REXX Batch file  |  1998-04-25  |  3KB  |  103 lines

  1. /* REXX deinstallation script for WarpTuner
  2.  * Copyright (C) 1998 by Dmitry Malenok
  3.  *
  4.  */
  5.  
  6. call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  7. call SysLoadFuncs
  8.  
  9. /*------------------------------------------------------------------
  10.  * Initialization 
  11.  *------------------------------------------------------------------*/
  12.  
  13. installdir = directory()"\"
  14. installlog = installdir"install.log"
  15.  
  16. if RxMessageBox( "Uninstall WarpTuner ?", "", "YesNo", "Query" ) == 7 then
  17.    exit
  18.  
  19. /*------------------------------------------------------------------
  20.  * Delete WarpTuner objects
  21.  *------------------------------------------------------------------*/
  22.  
  23. rc = SysDestroyObject("<WTFolder>")
  24.  
  25. if rc then
  26.    call log "WarpTuner objects removed from desktop..."
  27. else 
  28.    call log "ERROR: WarpTuner object removing failed!"
  29.  
  30. /*------------------------------------------------------------------
  31.  * Remove DEVICE statement from CONFIG.SYS
  32.  *------------------------------------------------------------------*/
  33.  
  34. /*------------------------------------------------------------------
  35.  * Remove Driver
  36.  *------------------------------------------------------------------*/
  37.  
  38. rc = SysIni( "BOTH", "FolderWorkareaRunningObjects", "ALL:", "objects" );
  39. configsys = left( objects.1, 2 )"\CONFIG.SYS"
  40. call log "CONFIG.SYS found as: "configsys"..."
  41.  
  42. configbak = SysTempFileName( left( objects.1, 2 )"\CONFIG.???" )
  43. "@copy "configsys" "configbak" 1>NUL 2>NUL"
  44.  
  45. if rc == 0 then
  46.    call log "Backup copy of "configsys" is placed in "configbak"..."
  47. else 
  48.    call log "ERROR: Creating backup copy of "configsys" failed!"
  49.  
  50. i = 1
  51. do while lines(configsys)
  52.    config.i = linein(configsys)
  53.    parse value translate(config.i) with  command "=" devpath
  54.    
  55.    if command \= "DEVICE" | lastpos( "TURNON.SYS", devpath ) == 0 then
  56.       i = i + 1
  57. end
  58. config.0 = i - 1
  59. rc = stream( configsys, 'c', 'close' )
  60. '@del 'configsys
  61.  
  62. rc = lineout( configsys,,1 )
  63. do i = 1 to config.0
  64.    rc = lineout( configsys, config.i )
  65. end
  66. rc = stream( configsys, 'c', 'close' )
  67.  
  68. call log "Driver removed from "configsys"..."
  69.  
  70. rc = SysIni( ,'Mini WarpTuner',, 'DELETE:')
  71. call log "Mini WarpTuner record removed from OS2.INI..."
  72. call log "------------------ Done! -----------------------"
  73. exit
  74.  
  75. /*------------------------------------------------------------------
  76.  * Get Yes or No
  77.  *------------------------------------------------------------------*/
  78. GetYesNo: procedure
  79.  
  80.    ok = 0
  81.  
  82.    do until ok
  83.       call charout, arg(1) || "? "
  84.       pull reply
  85.       reply = left(reply, 1)
  86.       ok = (reply = "Y") | (reply = "N")
  87.       if \ok then do
  88.          say 'Huh? Please enter "Y" or "N".'
  89.       end
  90.    end
  91.  
  92. return (reply = "Y")
  93.  
  94. /*------------------------------------------------------------------
  95.  * Write log message
  96.  *------------------------------------------------------------------*/
  97. Log: procedure expose installlog; parse arg msg
  98.  
  99.    say  "■■■ "msg
  100.    call lineout installlog, "UNINSTL: "msg
  101.  
  102. return
  103.