home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / phome106.zip / INSTALL.CMD < prev    next >
OS/2 REXX Batch file  |  1997-02-06  |  5KB  |  179 lines

  1. /* REXX installation script for PhonHome */
  2.  
  3. /*call SysLoadFuncs */
  4. call RxFuncAdd 'SysCls', 'RexxUtil', 'SysCls'
  5. call RxFuncAdd 'SysIni', 'RexxUtil', 'SysIni'
  6. call RxFuncAdd 'SysCreateObject', 'RexxUtil', 'SysCreateObject'
  7. call RxFuncAdd 'SysCurPos', 'RexxUtil', 'SysCurPos'
  8. call RxFuncAdd 'SysGetKey', 'RexxUtil', 'SysGetKey'
  9. call RxFuncAdd 'SysTextScreenRead', 'RexxUtil', 'SysTextScreenRead'
  10. call RxFuncAdd 'SysOS2Ver', 'RexxUtil', 'SysOS2Ver'
  11.  
  12.  
  13. call SysCls
  14. say ""
  15. say "****************************************************************"
  16. say "                      PHONHOME Installation"
  17. say "****************************************************************"
  18. say ""
  19.  
  20. rc = stream('phonhome.exe','c','query exists')
  21. if rc='' then
  22. do
  23.   say " Sorry, phonhome.exe not found.  Must not be wrong directory.  Terminating."
  24.   exit
  25. end
  26.  
  27. tcpetc = value('ETC',,'OS2ENVIRONMENT')
  28. parse var tcpetc os2dir'\'rest
  29. pcomdir = os2dir'\tcpip\pcomos2'
  30. rc=stream('C:\zoc\zoc.exe', 'c', 'query exists')
  31. if rc="" then
  32. do
  33.    rc=stream('D:\zoc\zoc.exe', 'c', 'query exists')
  34.    if rc="" then
  35.    do
  36.       rc=stream('E:\zoc\zoc.exe', 'c', 'query exists')
  37.       if rc="" then
  38.       do
  39.          rc=stream('F:\zoc\zoc.exe', 'c', 'query exists')
  40.          if rc="" then
  41.          do
  42.             rc=stream('G:\zoc\zoc.exe', 'c', 'query exists')
  43.          end
  44.       end
  45.    end 
  46. end
  47.  
  48. parse var rc zocdir'\'rest
  49. zocdir=zocdir'\zoc\script'
  50. instdir=""
  51. curdir = directory()
  52.  
  53. if curdir='A:\' | curdir='B:\' then
  54. do
  55.    flopdir=directory()
  56.    instdir='C'
  57.    say ' Press enter to Install PHONHOME on drive 'instdir' or enter alternative'
  58.    say ' drive such as D, E etc (type [exit] to cancel) >C'
  59.    pos=SysCurPos(6, 49)
  60.    do forever
  61.       key = SysGetKey('ECHO')
  62.       if key='0D'x then leave
  63.    end
  64.    answer=SysTextScreenRead(6,49,1)
  65.    say " "
  66.    if answer='exit' | answer='EXIT' then exit
  67.    if answer<>'' then
  68.    do
  69.       parse upper var answer answer
  70.       count=length(answer)
  71.       if count<>1 then
  72.       do
  73.          count=count-1
  74.          end=substr(answer,count,1)
  75.          if end=":" then instdir=answer''"\"
  76.          if end="\" then instdir=answer
  77.       end
  78.       if count=1 then instdir=answer''":\"
  79.       check=directory(instdir)
  80.       if check<>instdir then
  81.       do
  82.          say " Cannot find drive "answer
  83.          say " Cancelling installation"
  84.          exit
  85.       end
  86.       if check=instdir then
  87.       do
  88.           instd=instdir''"PHONHOME"
  89.       end
  90.    end
  91.  
  92.    say ""
  93.    say " Phonhome installation drive is "instdir
  94.    say ""
  95.    say " Continue with installation? Answer Y or N >Y"
  96.    pos=SysCurPos(10, 44)
  97.    pull answer .
  98.    if answer<>"" & answer<>"Y" & answer<>"yes" then
  99.    do
  100.       say ""
  101.       say " Answer was not Y, installation cancelled"
  102.       enddir=directory(flopdir)
  103.       exit
  104.    end
  105.    check=directory(instd)
  106.    newdir=directory(instdir)
  107.    if check<>instd then 'MD phonhome'
  108.    'copy A:\*.* 'instd
  109.    newdir=directory(flopdir)
  110.    newdir=newdir'runtime\'
  111.    newdir'unzip 'newdir'vrobj.zip -d 'instd
  112.    newdir=instd
  113. end
  114.  
  115. if curdir<>'A:\' & curdir<>'B:\' then
  116. do
  117.    instd=curdir
  118.    newdir=instd
  119.    say ""
  120.    say " Phonhome installation directory is "instd
  121.    say ""
  122.    say " Continue with installation? Answer Y or N >Y"
  123.    pos=SysCurPos(8, 44)
  124.    pull answer .
  125.    if answer<>"" & answer<>"Y" & answer<>"yes" then
  126.    do
  127.       say ""
  128.       say " Answer was not Y, installation cancelled"
  129.       exit
  130.    end
  131. end
  132.  
  133. 'MD 'instd'\download'
  134. 'MD 'instd'\upload'
  135.  
  136. call SysIni instd'\schedule.ini', inetlink, PROG, instd
  137.  
  138. 'COPY 'instd'\accecall.zrx 'zocdir
  139.  
  140. ver=SysOS2Ver()
  141. if ver="4.00" | ver="2.40" | ver>3.00 then
  142. do
  143.    'COPY 'instd'\phform.ws 'pcomdir
  144.    'COPY 'instd'\phremote.ws 'pcomdir
  145. end
  146.  
  147. filename = stream(instd'\phonhome.exe','c','query exists')
  148. if filename \= '' then
  149. do
  150.   title = "Phonhome"
  151.   classname = 'WPProgram'
  152.   location = '<WP_DESKTOP>'
  153.   setup = 'EXENAME='filename';STARTUPDIR='newdir
  154.   if existed = '' then setup = setup';PARAMETERS=%*'
  155.   call SysCreateObject classname,title,location,setup,u
  156. end
  157.  
  158. /*call SysCls */
  159.  
  160. say ""
  161. say ""
  162. say "----------------------------------------------------------------"
  163. say " Phonhome Scheduler "
  164. say " Written by Geoff Brown - All rights reserved "
  165. say "----------------------------------------------------------------"
  166. say ""
  167. say " Phonhome icon successfully created on the desktop..."
  168. say ""
  169. say " Start Phonhome by double-clicking on the program object."
  170. say ""
  171. say "****************************************************************"
  172. say " This program is  distributed as Shareware! You MUST register"
  173. say " this product if you  continue  to  use it. Please  see the help"
  174. say " directory for registration details."
  175. say "****************************************************************"
  176. say ""
  177.  
  178. exit
  179.