home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / ka2_12.zip / install.cmd < prev    next >
OS/2 REXX Batch file  |  1994-07-24  |  2KB  |  84 lines

  1. /* REXX - Installation */
  2. parse arg path
  3. Signal on Halt
  4. name = 'KA2'
  5. /* files.0 = 7 */
  6. files.0 = 8
  7.  
  8. files.1 = 'Kitchen.exe'
  9. files.2 = 'kitchen.hlp'
  10. files.3 = 'readme.1st'
  11. files.4 = 'register.frm'
  12. files.5 = 'problem.rpt'
  13. files.6 = 'Sample.ka'
  14. files.7 = 'kitchen.dft'
  15. files.8 = 'beta.txt'
  16. exe = 1
  17.  
  18. call RxFuncAdd "SysLoadFuncs", "RexxUtil", "SysLoadFuncs"
  19. call SysLoadFuncs
  20.  
  21. if path = '' then do
  22.   ret = SysIni('SYSTEM', 'FolderWorkareaRunningObjects', 'ALL:', 'Desktop')
  23.   if ret <> '' | Desktop.0 <> 1 then do                                    
  24.     say 'Error locating Desktop, C:\' || name || ' will be used as a default'
  25.     path = 'C:\' || name
  26.   end
  27.   else path = left(Desktop.1, 2) || '\' || name
  28. end
  29.  
  30. r = 0
  31. p = ''
  32. do until p = ''
  33. say path
  34.   if SysFileTree(path, 'dir.', 'DO') then do
  35.     say '*** Error ***'
  36.     r = 99
  37.     call halt
  38.   end
  39.   if dir.0 > 0 then
  40.     msg = 'EXISTS.'
  41.   else msg = 'will be CREATED.'
  42.   say name 'will be installed in the' translate(path) 'directory. The directory' msg
  43.   say 'Press <Enter> to accept, <Ctrl-C><Enter> to cancel or type a new directory path'
  44.   p = strip(linein())
  45.   if p <> '' then path = p
  46. end
  47.  
  48. path = strip(path, 'T', '\')
  49. if dir.0 = 0 then do
  50.   '@md 1>nul 2>nul' path
  51.   if rc <> 0 then do
  52.     say '*** ERROR *** Could not create directory' path
  53.     r = 99
  54.     call halt
  55.   end
  56. end
  57.  
  58. call sysfiletree files.exe, fsrc, 'FT'
  59. call sysfiletree path || '\' || files.exe, fdst, 'FT'
  60.  
  61. if fdst <> 1 | fsrc.1 <> fdst.1 then do
  62.   say 'Copying from' directory() 'to' path || '; please wait ...'
  63.   do i = 1 to files.0
  64.     '@copy 1>nul 2>nul' files.i path
  65.   end
  66. end
  67.  
  68. setup = 'EXENAME=' || path || '\' || files.exe || ';STARTUPDIR=' || path
  69. if SysCreateObject('WPProgram', name, '<WP_DESKTOP>', setup, 'F') then
  70.   say name 'has been created on your DESKTOP.'
  71. else do
  72.  say 'The program object' name 'could not be created, possible duplicate'
  73.  r = 99
  74.  call halt
  75. end
  76.  
  77. if r = 0 then say 'Install completed'
  78. '@pause'
  79. return r
  80. halt:
  81. say 'Install cancelled'
  82. '@pause'
  83.  
  84.