home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 9 Archive / 09-Archive.zip / afe30.zip / AFE-INST.CMD < prev    next >
OS/2 REXX Batch file  |  1995-12-16  |  5KB  |  216 lines

  1. /* AFE 3.0 Installation Process */
  2.  
  3. '@echo off'
  4.  
  5. call rxfuncadd sysloadfuncs,rexxutil,sysloadfuncs
  6. call sysloadfuncs
  7.  
  8. call SysCls
  9. Say '';Say ''
  10.  
  11. Say '  AFE INSTALLATION !';Say '';say ''
  12.  
  13. /* check for presence of required files */
  14.  
  15. exe=Stream('afe.exe','c','query exists')<>''
  16. ico=Stream('afe.ico','c','query exists')<>''
  17. cfg=Stream('afe-cfg.exe','c','query exists')<>''
  18. dll=Stream('vrobj.dll','c','query exists')<>''
  19.  
  20. if exe=0 then do
  21. say '  Can not find AFE.EXE !';exit
  22. end
  23.  
  24. if ico=0 then do
  25. say '  Can not find AFE.ICO !';exit
  26. end
  27.  
  28. if cfg=0 then do
  29. say '  Can not find AFE-CFG.EXE !';exit
  30. end
  31.  
  32. if dll=0 then do
  33. say '  Can not find VROBJ.DLL !';exit
  34. end
  35.  
  36. Say '  Will copy program to correct drive/directory and create a'
  37. say '  desktop object...';say '';say ''
  38.  
  39. /* get the path to install AFE files */
  40.  
  41. Say '  Give me the full pathname where you want AFE installed,'
  42. Say '  including the drive.';say '';say '        Example: d:\bin\afe'
  43. say ''
  44.  
  45. pull pathname
  46.  
  47. if pathname='' then do
  48. say '';say '  No path specified !'
  49. exit
  50. end
  51.  
  52. /* if the user appended a "\" at the end of his path we don't want it */
  53.  
  54. if right(pathname,1)=="\" then do
  55. pathlength=length(pathname)
  56. pathlength=pathlength-1
  57. newafepath=substr(pathname,1,pathlength)
  58. pathname=newafepath
  59. end
  60.  
  61. /* however, if it's the root directory we do want the "\" */
  62.  
  63. if right(pathname,1)==":" then do
  64. pathname=''pathname'\'
  65. end
  66.  
  67. /* make sure it's a real path */
  68.  
  69. call SysFileTree pathname,'file','d'
  70. if file.0=0 then do
  71. rc=SysMkDir(''pathname'')
  72.   if rc>0 then do
  73.   say '';say '  Path does not exist and can not be created !'
  74.   exit
  75.   end
  76. end
  77.  
  78. call SysCls
  79. say '';say '  Copying files...'
  80.  
  81. /* if we appended a "\" we now need to remove it */
  82.  
  83. if right(pathname,1)=="\" then do
  84. pathlength=length(pathname)
  85. pathlength=pathlength-1
  86. newafepath=substr(pathname,1,pathlength)
  87. pathname=newafepath
  88. end
  89.  
  90. /* if there are already AFE files there let's make sure that they
  91.    can be overwritten */
  92.  
  93. over=Stream(''pathname'\afe*','c','query exists')<>''
  94. if over>0 then do
  95. call SysFileTree ''pathname'\afe*','files','f','*-*+*','-----'
  96.  
  97. /* if there is an old AFE.CFG or AFE.INI get rid of them */
  98.  
  99. if Stream(''pathname'\afe.cfg','c','query exists')<>'' then do
  100. call SysFileDelete ''pathname'\afe.cfg';end
  101.  
  102. if Stream(''pathname'\afe.ini','c','query exists')<>'' then do
  103. call SysFileDelete ''pathname'\afe.ini';end
  104.  
  105. end
  106.  
  107. /* if this is the root we need that trailing "\" */
  108.  
  109. if right(pathname,1)==":" then do
  110. pathname=''pathname'\'
  111. end
  112.  
  113. /* copy the files */
  114.  
  115. 'copy afe.exe 'pathname''
  116. 'copy afe.ico 'pathname''
  117. 'copy afe-cfg.exe 'pathname''
  118.  
  119. /* need to get rid of that trailing "\" again */
  120.  
  121. if right(pathname,1)=="\" then do
  122. pathlength=length(pathname)
  123. pathlength=pathlength-1
  124. newafepath=substr(pathname,1,pathlength)
  125. pathname=newafepath
  126. end
  127.  
  128. call SysCls;say '';say '  Done!';SAY '';say '  Now I need a place to put the DLL';say ''
  129. say '  Give me a full pathname (must be in your CONFIG.SYS LIBPATH statement)';say ''
  130. say '       Example: c:\os2\dll'
  131. say ''
  132.  
  133. /* now get the path to put the DLL file */
  134.  
  135. pull DLLpath
  136.  
  137. if dllpath='' then do
  138. say '';say '  No path specified !'
  139. exit
  140. end
  141.  
  142. if right(DLLpath,1)=="\" then do
  143. pathlength=length(DLLpath)
  144. pathlength=pathlength-1
  145. newDLLpath=substr(DLLpath,1,pathlength)
  146. DLLpath=newDLLpath
  147. end
  148.  
  149. if right(DLLpath,1)==":" then do
  150. DLLpath=''DLLpath'\'
  151. end
  152.  
  153. call SysFileTree dllpath,'file','d'
  154. if file.0=0 then do
  155. say ' Path does not exist !';exit;end
  156.  
  157. call SysCls
  158. say '';say '  Copying files...'
  159.  
  160. if right(DLLpath,1)=="\" then do
  161. pathlength=length(DLLpath)
  162. pathlength=pathlength-1
  163. newDLLpath=substr(DLLpath,1,pathlength)
  164. DLLpath=newDLLpath
  165. end
  166.  
  167. over=Stream(''DLLpath'\vrobj.dll','c','query exists')<>''
  168. if over>0 then do
  169.    call SysFileTree ''DLLpath'\vrobj.dll','files','f','*-*+*','-----'
  170.  end
  171.  
  172. if right(DLLpath,1)==":" then do
  173. DLLpath=''DLLpath'\'
  174. end
  175.  
  176. 'copy vrobj.dll 'dllpath''
  177.  
  178. call SysCls;say '';say '  Done!';say ''
  179.  
  180. Say '  Now creating Desktop object...'
  181.  
  182. /* create a desktop object for AFE */
  183.  
  184. classname='WPProgram'
  185. title='AFE 3.0'
  186. location='<WP_DESKTOP>'
  187. setup='MINIMIZED=YES;PROGTYPE=PM;EXENAME='pathname'\AFE.EXE;OBJECTID=<WP_DESKTOP_AFE>;ASSOCFILTER=*.zip,*.lzh,*.zoo,*.arj;ICONFILE='pathname'\AFE.ICO;STARTUPDIR='pathname';'
  188.  
  189. BldObj:
  190.  
  191. result=SysCreateObject(classname,title,location,setup,'r')
  192.  
  193. If result=1 Then do
  194.  
  195. call SysCls
  196. say '';say '  Object created!';Say '';Say '  All done!';SAY ''
  197. say '  The AFE program object is installed on your desktop.'
  198. say '';say '';say '  Ready to start AFE Configuration...'
  199. say '';say ''
  200.  
  201. 'pause'
  202.  
  203. /* start the program */
  204.  
  205. call SysCls
  206. call syssetobjectdata '<WP_DESKTOP_AFE>','open=default'
  207. 'exit'
  208. end
  209.  
  210. Else do
  211. call SysCls
  212. say '';say '  Not created! Return code='result
  213. exit
  214. end
  215.  
  216.