home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 3 Comm / 03-Comm.zip / zoc-smod.zip / install.cmd < prev    next >
OS/2 REXX Batch file  |  1997-03-16  |  3KB  |  113 lines

  1. /* SMODEM for ZOC installer */
  2.  
  3. parse arg parm
  4. parm = strip(parm)
  5.  
  6. /* Introduction */
  7.  
  8. say 'SMODEM for ZOC installer powered by REXX POWER!!'
  9. say 'This installer uses and includes freeware Info-ZIP UNZIP 5.x'
  10. say
  11.  
  12. if (parm = '' | pos('?',parm) > 0) then do
  13.    say 'Usage:  INSTALL <ZOC directory>'
  14.    say 'ie:  install g:\ZOC'
  15.    exit
  16. end
  17.  
  18. /* Remove trailing backslash */
  19. if lastpos('\',parm) = length(parm) then parm = left(parm,length(parm) - 1)
  20.  
  21. /* Load necessary RexxUtil functions */
  22. call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  23. call SysLoadFuncs
  24.  
  25. say 'Creating' parm'\SMODEM'
  26. rc = SysMkDir(parm'\SMODEM')
  27. if rc > 0 then do
  28.   say 'Failed creating' parm'\SMODEM'
  29.   if rc = 5 then say 'Please remove the existing directory first'
  30.   exit
  31. end
  32.  
  33. say 'Searching ZOC script path'
  34. if sysfilesearch('SCRIPT',parm'\options\standard.zpa',scriptpath) = 2 then do
  35.    say 'Error opening' parm'\options\standard.zpa'
  36.    exit
  37. end
  38. scriptpath = parm||'\'||substr(scriptpath.1,pos('="',scriptpath.1) + 2,lastpos('"',scriptpath.1) - pos('="',scriptpath.1) - 2)
  39.  
  40. /* unzip */
  41. 'unzip -o sp103.zip -d 'parm'\smodem'
  42. 'unzip -o ostsr12i.zip -d 'parm'\smodem'
  43. 'unzip -o smodem10.zip -d 'parm'\smodem'
  44. 'copy smodemdl.rx' scriptpath
  45. 'copy smodemul.rx' scriptpath
  46.  
  47. say 'Adding ZOC keys'
  48. call SysFileSearch '62|0C|-1|-1|0|0|^RUN=smodemul.rx', parm'\options\standard.zky', dump
  49. if dump.0 = 0 then
  50.    call lineout parm'\options\standard.zky','62|0C|-1|-1|0|0|^RUN=smodemul.rx'
  51.  
  52. call SysFileSearch '67|0C|-1|-1|0|0|^RUN=smodemdl.rx', parm'\options\standard.zky', dump
  53. if dump.0 = 0 then
  54.    call lineout parm'\options\standard.zky','67|0C|-1|-1|0|0|^RUN=smodemdl.rx'
  55.  
  56. call lineout parm'\options\standard.zky'
  57.  
  58. /* find bootdrive */
  59. irc = SysIni( "BOTH","FolderWorkareaRunningObjects","ALL:","Objects" )
  60. BootDrive = left(Objects.1,2)
  61.  
  62. /* stick VDOSPRIO.SYS */
  63. found = 0
  64. if SysFileSearch('VDOSPRIO.SYS', bootdrive'\CONFIG.SYS', dump) = 3 then do
  65.    say 'Boot drive not detect proprely.  Edit INSTALL.CMD, find '
  66.    say '"BootDrive = left(Objects.1,2)" and replace with'
  67.    say '"BootDrive = <your boot drive>" ex.: "BootDrive = C:"'
  68.    exit
  69. end
  70.  
  71. i = 1
  72. do while i <= dump.0
  73.    if pos('DEVICE=', translate(strip(dump.i))) = 1 then found = 1
  74.    i = i + 1
  75. end
  76.  
  77. if found = 0 then do
  78.    say 'Adding VDOSPRIO.SYS to CONFIG.SYS'
  79.    i = 0
  80.    do until file.0 = 0
  81.       i = i + 1
  82.       call sysfiletree bootdrive'\CONFIG.'i,file
  83.    end
  84.    'copy' bootdrive'\CONFIG.SYS' bootdrive'\CONFIG.'i
  85.    call lineout bootdrive'\CONFIG.SYS','DEVICE='parm'\SMODEM\VDOSPRIO.SYS'
  86.    call lineout bootdrive'\CONFIG.SYS'
  87. end
  88.  
  89. /* stick OSTSR.COM */
  90. found = 0
  91. call SysFileSearch 'OSTSR', bootdrive'\AUTOEXEC.BAT', dump
  92. i = 1
  93. do while i <= dump.0
  94.    if pos('REM', translate(strip(dump.i))) <> 1 then found = 1
  95.    i = i + 1
  96. end
  97.  
  98. if found = 0 then do
  99.    say 'Adding OSTSR.COM to AUTOEXEC.BAT'
  100.    i = 0
  101.    do until file.0 = 0
  102.       i = i + 1
  103.       call sysfiletree bootdrive'\AUTOEXEC.'i,file
  104.    end
  105.    'copy' bootdrive'\AUTOEXEC.BAT' bootdrive'\AUTOEXEC.'i
  106.    call lineout bootdrive'\AUTOEXEC.BAT','LH' parm'\SMODEM\OSTSR'
  107.    call lineout bootdrive'\AUTOEXEC.BAT'
  108. end
  109.  
  110. Say 'Finished!'
  111.  
  112. exit
  113.