home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / wtun0612.zip / install.cmd < prev    next >
OS/2 REXX Batch file  |  1998-05-06  |  5KB  |  153 lines

  1. /* REXX installation 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 GetYesNo( "Install WarpTuner in "installdir ) == 0 then
  17.    exit
  18.  
  19. /*------------------------------------------------------------------
  20.  * Create WarpTuner folder
  21.  *------------------------------------------------------------------*/
  22.  
  23. rc = SysCreateObject( "WPFolder","WarpTuner","<WP_DESKTOP>",,
  24.                       "OBJECTID=<WTFolder>;ALWAYSSORT=Yes" ,"REPLACE" )
  25.  
  26. if rc then
  27.    call log "WarpTuner folder successfully created on desktop..."
  28. else
  29.    call log "ERROR:WarpTuner folder creating failed!"
  30.  
  31. /*------------------------------------------------------------------
  32.  * Create MiniTuner object
  33.  *------------------------------------------------------------------*/
  34.  
  35. rc = SysCreateObject( "WPProgram", "MiniTuner", "<WTFolder>",,
  36.                       "OBJECTID=<MINITUN>;EXENAME="installdir"minitun.EXE;STARTUPDIR="installdir,
  37.                       "REPLACE" )
  38.  
  39. if rc then
  40.    call log "MiniTuner object successfully created..."
  41. else 
  42.    call log "ERROR: MiniTuner object creating failed!"
  43.  
  44. rc = SysCreateObject( "WPShadow", "MiniTuner", "<WP_START>",,
  45.                       "SHADOWID=<MINITUN>",,
  46.                       "REPLACE" )
  47.  
  48. if rc then
  49.    call log "MiniTuner object added in Startup folder..."
  50. else 
  51.    call log "ERROR: MiniTuner object adding in Startup folder failed!"
  52.  
  53. /*------------------------------------------------------------------
  54.  * Create WarpTuner object
  55.  *------------------------------------------------------------------*/
  56.  
  57. rc = SysSetIcon(installdir"warptun.EXE",installdir"radio.ico")
  58. rc = SysCreateObject( "WPProgram", "WarpTuner", "<WTFolder>",,
  59.                       "EXENAME="installdir"warptun.EXE;STARTUPDIR="installdir,,
  60.                       "REPLACE" )
  61.  
  62. if rc then
  63.    call log "WarpTuner object successfully created..."
  64. else 
  65.    call log "ERROR: WarpTuner object creating failed!"
  66.  
  67. /*------------------------------------------------------------------
  68.  * Create WarpTuner Uninstall object
  69.  *------------------------------------------------------------------*/
  70.  
  71. rc = SysCreateObject( "WPProgram", "Uninstall WarpTuner", "<WTFolder>",,
  72.                       "ICONFILE="installdir"UNINSTL.ICO;EXENAME=*;PROGTYPE=PM;PARAMETERS=/C "installdir"UNINSTL.CMD;STARTUPDIR="installdir,,
  73.                       "REPLACE" )
  74.  
  75. if rc then
  76.    call log "Uninstall object successfully created..."
  77. else 
  78.    call log "ERROR: Uninstall object creating failed!"
  79.  
  80.  
  81. /*------------------------------------------------------------------
  82.  * Install Driver
  83.  *------------------------------------------------------------------*/
  84.  
  85. SAY "Enter tuner port in hex:"
  86. PULL TunerPort
  87. SAY "Enter sound blaster port in hex:"
  88. PULL SBPort
  89.  
  90. rc = SysIni( "BOTH", "FolderWorkareaRunningObjects", "ALL:", "objects" );
  91. configsys = left( objects.1, 2 )"\CONFIG.SYS"
  92. call log "CONFIG.SYS found as: "configsys"..."
  93.  
  94. configbak = SysTempFileName( left( objects.1, 2 )"\CONFIG.???" )
  95. "@copy "configsys" "configbak" 1>NUL 2>NUL"
  96.  
  97. if rc == 0 then
  98.    call log "Backup copy of "configsys" is placed in "configbak"..."
  99. else 
  100.    call log "ERROR: Creating backup copy of "configsys" failed!"
  101.  
  102. i = 1
  103. do while lines(configsys)
  104.    config.i = linein(configsys)
  105.    parse value translate(config.i) with  command "=" devpath
  106.    
  107.    if command \= "DEVICE" | lastpos( "TURNON.SYS", devpath ) == 0 then
  108.       i = i + 1
  109. end
  110. config.0 = i - 1
  111. rc = stream( configsys, 'c', 'close' )
  112. '@del 'configsys
  113.  
  114. rc = lineout( configsys,,1 )
  115. do i = 1 to config.0
  116.    rc = lineout( configsys, config.i )
  117. end
  118. rc = lineout( configsys, "device="installdir"turnon.sys "SBPort" "TunerPort )
  119. rc = stream( configsys, 'c', 'close' )
  120.  
  121. call log "Driver added in "configsys"..."
  122. call log "------------------ Done! -----------------------"
  123. exit
  124.  
  125. /*------------------------------------------------------------------
  126.  * Get Yes or No
  127.  *------------------------------------------------------------------*/
  128. GetYesNo: procedure
  129.  
  130.    ok = 0
  131.  
  132.    do until ok
  133.       call charout, arg(1) || "? "
  134.       pull reply
  135.       reply = left(reply, 1)
  136.       ok = (reply = "Y") | (reply = "N")
  137.       if \ok then do
  138.          say 'Huh? Please enter "Y" or "N".'
  139.       end
  140.    end
  141.  
  142. return (reply = "Y")
  143.  
  144. /*------------------------------------------------------------------
  145.  * Write log message
  146.  *------------------------------------------------------------------*/
  147. Log: procedure expose installlog; parse arg msg
  148.  
  149.    say  "■■■ "msg
  150.    call lineout installlog, "INSTALL: "msg
  151.  
  152. return
  153.