home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 6 File / 06-File.zip / dcopypm9.zip / INSTALL.CMD
OS/2 REXX Batch file  |  1994-01-22  |  4KB  |  144 lines

  1. /* INSTALL origin Bernd Wetzel 1993                                          */
  2. /* procedure to install Dcopy on the harddisk                                */
  3. CALL RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  4. CALL SysLoadFuncs 
  5.  
  6. title = 'Installation of DCopy'
  7. sourcepath = '.\DCOPY'
  8. sourcedll = '.\DCOPYDLL'
  9. targetpath = 'C:\OS2\APPS'
  10. targetdll  = 'C:\OS2\DLL'
  11. file.0 = 4
  12. file.1 = 'DCOPY.EXE'
  13. file.2 = 'DCOPY.TIC'
  14. file.3 = 'DCOPY.CNF'
  15. file.4 = 'DCOPY.DOC'
  16. file.5 = 8
  17. file.6 = 'SUPPDEL.DLL'
  18. file.7 = 'SUPPCPY.DLL'
  19. file.8 = 'SUPPZIP.DLL'
  20.  
  21. CALL SysCls
  22. SAY 
  23. SAY ''title''
  24. SAY 'By default DCopy will be installed to' targetpath'.'
  25. SAY 'Enter "Y" to confirm, "N" to exit or enter a new path (e.g. C:\DCOPY)'
  26. SAY 'where DCopy should be installed.'
  27. SAY 'Press <ENTER> when ready.'
  28. PULL answer .
  29. IF (answer <> 'Y') THEN DO
  30.   IF (answer = 'N') THEN EXIT 1
  31.   targetpath = answer
  32. END
  33.  
  34. '@CD' sourcepath
  35. IF (rc <> 0) THEN DO
  36.    SAY 'DCopy could not be found in' sourcepath '!'
  37.    SAY title 'will be terminated.'
  38.    EXIT 2
  39. END
  40.  
  41. /* Check for all the files in the current directory                           */
  42. filemissing = 0
  43. DO i = 1 TO file.0
  44.   search = file.i
  45.   sysrc = SysFileTree(search, ret, 'FO')
  46.   IF (ret.0 = 0 | sysrc <> 0) THEN DO
  47.     SAY file.i 'is missing in the current directory'
  48.     filemissing = 1
  49.   END
  50. END
  51. IF filemissing = 1 THEN DO
  52.   EXIT 1
  53. END
  54.  
  55. sysrc = SysMkDir(targetpath)
  56. IF (sysrc <> 0) THEN DO
  57.   SAY 'Directory' targetpath 'could not be created !'
  58.   IF (sysrc = 5) THEN SAY 'Directory already exists !'
  59.   SAY 'Enter "Y" to confirm, "N" to exit'
  60.   SAY 'Press <ENTER> when ready.'
  61.   PULL answer .
  62.   IF (answer <> 'Y') THEN EXIT 2
  63. END
  64.  
  65. SAY 'DCopy will be installed to 'targetpath' ...'
  66. DO i = 1 TO file.0
  67.   target = targetpath || '\' || file.i
  68.   '@COPY' file.i '/B' target '/V >nul 2>nul'
  69.   IF (rc <> 0) THEN DO
  70.     SAY 'File' file.i 'could not be copied to' targetpath '!'
  71.     SAY title 'will be terminated.'
  72.     EXIT 3
  73.   END
  74. END
  75.  
  76.  
  77. SAY
  78. SAY ''title''
  79. SAY 'By default DCopy-DLLs will be installed to' targetdll'.'
  80. SAY 'Enter "Y" to confirm, "N" to exit or enter a new path (e.g. C:\DCOPY\DLL)'
  81. SAY 'where the DLL should be installed (Think of your LIBPATH!).'
  82. SAY 'Press <ENTER> when ready.'
  83. PULL answer .
  84. IF (answer <> 'Y') THEN DO
  85.   IF (answer = 'N') THEN EXIT 1
  86.   targetdll = answer
  87. END
  88.  
  89. j=i
  90.  
  91. '@CD' sourcedll
  92. IF (rc <> 0) THEN DO
  93.    SAY 'DCopy DLLs could not be found in' sourcedll '!'
  94.    SAY title 'will be terminated.'
  95.    EXIT 2
  96. END
  97.  
  98. /* Check for all the files in the current directory                           */
  99. filemissing = 0
  100. DO i = j+1 TO file.j
  101.   search = file.i
  102.   sysrc = SysFileTree(search, ret, 'FO')
  103.   IF (ret.0 = 0 | sysrc <> 0) THEN DO
  104.     SAY file.i 'is missing in the current directory'
  105.     filemissing = 1
  106.   END
  107. END
  108. IF filemissing = 1 THEN DO
  109.   EXIT 1
  110. END
  111.  
  112. sysrc = SysMkDir(targetdll)
  113. IF (sysrc <> 0) THEN DO
  114.   SAY 'Directory' targetdll 'could not be created !'
  115.   IF (sysrc = 5) THEN SAY 'Directory already exists !'
  116.   SAY 'Enter "Y" to confirm, "N" to exit'
  117.   SAY 'Press <ENTER> when ready.'
  118.   PULL answer .
  119.   IF (answer <> 'Y') THEN EXIT 2
  120. END
  121.  
  122. SAY 'DCopy-DLLs will be installed to 'targetdll' ...'
  123. DO i = j+1 TO file.j
  124.   target = targetdll || '\' || file.i
  125.   '@COPY' file.i '/B' target '/V >nul 2>nul'
  126.   IF (rc <> 0) THEN DO
  127.     SAY 'File' file.i 'could not be copied to' targetdll '!'
  128.     SAY title 'will be terminated.'
  129.     EXIT 3
  130.   END
  131. END
  132.  
  133.  
  134. SAY 'DCopy will be created as object on the desktop ...'
  135. sysrc = SysCreateObject('WPProgram','DCopy','<WP_DESKTOP>','EXENAME='|| targetpath || '\' || file.1';PROGTYPE=PM;STARTUPDIR='||targetpath)
  136. IF (sysrc <> 1) THEN DO
  137.   SAY 'Object could not be created on the desktop !'
  138.   SAY title 'will be terminated.'
  139.   EXIT 4
  140. END
  141.  
  142. SAY 'DCopy was successfully installed to 'targetpath'.'
  143. EXIT 0
  144.