home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1999 February / PCO_0299.ISO / filesbbs / os2 / nftp141o.arj / NFTP141O.ZIP / install.cmd < prev    next >
Encoding:
Text File  |  1998-11-19  |  4.8 KB  |  180 lines

  1. /* REXX */
  2.  
  3. /* Load RexxUtil extensions */
  4. if RxFuncQuery("SysLoadFuncs") then do
  5.     say "loading RexxUtil extensions..."
  6.     call RxFuncAdd "SysLoadFuncs","RexxUtil","SysLoadFuncs"
  7.     if result \= "0" then do
  8.         say "error loading RexxUtil.dll"
  9.         exit
  10.     end
  11.     call SysLoadFuncs
  12. end
  13.  
  14. /* ask user about directories etc. */
  15. Call SysCls
  16. say
  17. say "NFTP Version 1.40 installation"
  18. say
  19. say "This script will do the following:"
  20. say "1) copy required files into the directory you specified;"
  21. say "2) create objects on your desktop"
  22. say
  23.  
  24. numlangs = 17
  25. lang.1  = "English   "
  26. lang.2  = "Russian   "
  27. lang.3  = "Chinese   "
  28. lang.4  = "Spanish   "
  29. lang.5  = "Swedish   "
  30. lang.6  = "Hungarian "
  31. lang.7  = "German    "
  32. lang.8  = "Danish    "
  33. lang.9  = "Japanese  "
  34. lang.10 = "Norwegian "
  35. lang.11 = "Italian   "
  36. lang.12 = "Brazilian "
  37. lang.13 = "Dutch     "
  38. lang.14 = "French    "
  39. lang.15 = "Bulgarian "
  40. lang.16 = "Ukrainian "
  41. lang.17 = "Polish"
  42. lang.18 = ""
  43.  
  44. choose_language:
  45.     
  46. say "Enter no. of language you wish to install:"
  47. say
  48. do i = 1 to numlangs by 3
  49.     i1 = i + 1
  50.     i2 = i + 2
  51.     if i <> 16 then
  52.        say right(i,2)")" lang.i "    " right(i1,2)")" lang.i1 "    " right(i2,2)")" lang.i2
  53.     else
  54.        say right(i,2)")" lang.i
  55. end
  56. say
  57. say "Empty line entered will abort installation."
  58. parse pull langno .
  59. if langno = "" then exit
  60. if (langno > numlangs) | (langno < 1) then do
  61.     say "The number you entered is outside of range"
  62.     say
  63.     signal choose_language
  64. end
  65. language = lang.langno
  66.  
  67. say
  68. say "Enter destination directory (where NFTP files will be installed)."
  69. say "WARNING: this must be HPFS drive (to support long filenames)."
  70. say "If you wish to install NFTP into the subtree (eg, ""d:\apps\tcpip\nftp"")"
  71. say "you have to create upper directory first (""d:\apps\tcpip"" in the"
  72. say "above example). Enter ""."" to install into the current directory."
  73. say "Empty line entered will abort installation."
  74. say
  75. parse pull destpath .
  76. if destpath = "" then exit
  77.  
  78. destpath = strip(destpath, "T", "\")
  79. dlpath = strip(dlpath, "T", "\")
  80.  
  81. /* verify choices */
  82. call SysCls
  83. say "Installing NFTP into the directory :" destpath
  84. say "NFTP language                      :" language
  85. say
  86. say "Press Ctrl-C to abort or any other key to continue"
  87. say
  88. '@pause >nul'
  89. Call SysCls
  90.  
  91. /* creating target directories if necessary */
  92. if destpath <> "." then
  93. do
  94.     call SysFileTree destpath, "srch", "D"
  95.     if srch.0 = 0 then do
  96.         rc = SysMkDir(destpath)
  97.         if rc <> 0 then do
  98.             say "Fatal error: cannot create directory" destpath
  99.             exit
  100.         end
  101.     end
  102.     call SysFileTree destpath"\nls", "srch", "D"
  103.     if srch.0 = 0 then do
  104.         rc = SysMkDir(destpath"\nls")
  105.         if rc <> 0 then do
  106.             say "Fatal error: cannot create directory" destpath"\nls"
  107.             exit
  108.         end
  109.     end
  110. end
  111.     
  112. /* copying NFTP files */
  113. if destpath <> "." then
  114. do
  115.     '@copy * 'destpath' >nul'
  116.     '@copy 'destpath'\*.nls 'destpath'\nls\ >nul'
  117.     '@copy 'destpath'\*.mnu 'destpath'\nls\ >nul'
  118.     '@del 'destpath'\*.nls' destpath'\*.mnu'
  119.     say "Files were copied to" destpath
  120. end
  121.  
  122. if destpath = "." then destpath = directory()
  123. if dlpath = "." then dlpath = directory()
  124.     
  125. /* making sure we will not overwrite existing nftp.mrk */
  126. if stream(destpath"\nftp.bmk", "C", "QUERY EXISTS") == "" then
  127.    if stream(destpath"\nftp.mrk", "C", "QUERY EXISTS") <> "" then
  128.       call bmkconv destpath"\nftp.mrk" destpath"\nftp.bmk"
  129.    else
  130.      '@copy nftp.bm 'destpath'\nftp.bmk >nul'
  131.  
  132. /* checking 'nftp.ini' presence */
  133. newinifile = destpath"\nftp.ini"
  134. if stream(destpath"\nftp.ini", "C", "QUERY EXISTS") == "" then 
  135. do
  136.     /* creating new 'nftp.ini' */
  137.     call SysFileDelete newinifile
  138.     signal off notready
  139.     say
  140.  
  141.     do forever
  142.        say
  143.        say "Enter your e-mail address (to be used as a password for anonymous logins):"
  144.        parse pull email .
  145.        email = strip(email)
  146.        if email <> "" then leave
  147.     end
  148.  
  149.     do forever
  150.         lin = linein("nftp.i")
  151.         newlin = lin
  152.         if substr(lin,1,20) = ';anonymous-password=' then
  153.             newlin = 'anonymous-password="'email'"'
  154.         rc = lineout(newinifile, newlin)
  155.         if lin = "" & left(stream("nftp.i"),5) <> "READY" then leave
  156.     end
  157.     call stream "nftp.i", "C", "CLOSE"
  158.     call stream newinifile, "C", "CLOSE"
  159. end
  160.  
  161. /* creating nftp.cmd */
  162.  
  163. cmdfile = destpath"\nftp.cmd"
  164. call SysFileDelete cmdfile    
  165. rc = lineout(cmdfile, "@set NFTP_LANG="strip(language))
  166. rc = lineout(cmdfile, "@"destpath"\nftp.exe %1 %2 %3 %4 %5 %6")
  167. call stream cmdfile, "C", "CLOSE"
  168.  
  169. '@pause'
  170. Call SysCls
  171.  
  172. call makeobjs destpath
  173.  
  174. /* looks like we're done... */
  175. say
  176. say "Installation complete."
  177. say
  178. '@pause'
  179. Exit
  180.