home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 1994 October / SOFM_Oct1994.bin / pc / os2 / fm2 / install.cmd < prev    next >
OS/2 REXX Batch file  |  1994-08-08  |  7KB  |  243 lines

  1. /*
  2.  * FM/2 2.x installation program copyright (c) 1994 by M. Kimes
  3.  *
  4.  * This program creates a folder to hold program objects,
  5.  * then creates program objects for each executable.  It only needs to be
  6.  * run once (unless you move the FM/2 directory -- see say notes at end).
  7.  * It also calls MIGINI.CMD if it finds an old FM2.INI file to migrate
  8.  * some information to the new version's FM3.INI file.
  9.  *
  10.  * For unattended installation, remove the lines marked with "NOTE:" below.
  11.  */
  12.  
  13. /* see if we might be in the right directory... */
  14.  
  15. '@Echo off'
  16. 'cls'
  17.  
  18. 'echo  ┌───────────────────────────────────────────────────────────────────┐'
  19. 'echo  │                  FM/2 2.x Installation Program                    │'
  20. 'echo  │             FM/2 is copyright (c) 1993/94 by M. Kimes             │'
  21. 'echo  │                       All rights reserved                         │'
  22. 'echo  └───────────────────────────────────────────────────────────────────┘'
  23.  
  24. rc = stream('fm3.exe','c','query exists')
  25. if rc = '' then
  26. do
  27.   say 'Sorry, FM3.EXE not found.  Must not be right directory.  Terminating.'
  28.   exit
  29. end
  30.  
  31. /* tell user what we're doing, give him a chance to hit CTRL-C */
  32.  
  33. say ''
  34. say 'This program creates objects for FM/2.'
  35. say ''
  36.  
  37.  
  38.  
  39. /* NOTE:  remove following 3 lines for unattended use... */
  40. say 'Press [Enter].'
  41. pull dummy .
  42. say ''
  43.  
  44.  
  45. /* save current directory */
  46.  
  47. curdir = directory()
  48.  
  49. /* load rexx utility functions */
  50.  
  51. call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  52. call SysLoadFuncs
  53.  
  54. /* say it, then do it */
  55.  
  56. say "Creating File Manager/2 folder and program objects..."
  57.  
  58. /* first, create FM/2 folder */
  59.  
  60. title = "File Manager/2"
  61. classname = 'WPFolder'
  62. location = '<WP_DESKTOP>'
  63. setup = 'OBJECTID=<FM3_Folder>;OPEN=DEFAULT'
  64. result=SysCreateObject(classname,title,location,setup,f)
  65.  
  66. /* NOTE:  remove following 9 lines for unattended use... */
  67. if result = 0 then
  68. do
  69.   say ''
  70.   say 'The File Manager/2 folder already exists.'
  71.   say 'Should I replace the objects? (Y/N)'
  72.   parse upper pull dummy
  73.   if left(dummy,1) = 'N' then exit
  74.   say ''
  75. end
  76.  
  77. /* now, create program objects in FM/2 folder */
  78.  
  79. title = "File Manager/2"
  80. classname = 'WPProgram'
  81. location = '<FM3_Folder>'
  82. setup = 'EXENAME='curdir'\FM3.EXE;PARAMETERS=%*;STARTUPDIR='curdir
  83. call SysCreateObject classname,title,location,setup,u
  84.  
  85. rc = stream('av2.exe','c','query exists')
  86. if rc \= '' then
  87. do
  88.   title = "Archive Viewer/2"
  89.   classname = 'WPProgram'
  90.   location = '<FM3_Folder>'
  91.   setup = 'EXENAME='curdir'\AV2.EXE;PARAMETERS=%*;STARTUPDIR='curdir';ASSOCFILTER=*.ZIP,*.ARC,*.LZH,*.ARJ,*.ZOO,*.MO0'
  92.   call SysCreateObject classname,title,location,setup,u
  93. end
  94.  
  95. rc = stream('doicon.exe','c','query exists')
  96. if rc \= '' then
  97. do
  98.   title = "SysIcon"
  99.   classname = 'WPProgram'
  100.   location = '<FM3_Folder>'
  101.   setup = 'EXENAME='curdir'\DOICON.EXE;PARAMETERS=%*;STARTUPDIR='curdir
  102.   call SysCreateObject classname,title,location,setup,u
  103. end
  104.  
  105. rc = stream('eas.exe','c','query exists')
  106. if rc \= '' then
  107. do
  108.   title = "EA Viewer"
  109.   classname = 'WPProgram'
  110.   location = '<FM3_Folder>'
  111.   setup = 'EXENAME='curdir'\EAS.EXE;PARAMETERS=%*;STARTUPDIR='curdir
  112.   call SysCreateObject classname,title,location,setup,u
  113. end
  114.  
  115. rc = stream('ini.exe','c','query exists')
  116. if rc \= '' then
  117. do
  118.   title = "INI Viewer"
  119.   classname = 'WPProgram'
  120.   location = '<FM3_Folder>'
  121.   setup = 'EXENAME='curdir'\INI.EXE;PARAMETERS=%*;STARTUPDIR='curdir';ASSOCFILTER=*.INI'
  122.   call SysCreateObject classname,title,location,setup,u
  123. end
  124.  
  125. rc = stream('killproc.exe','c','query exists')
  126. if rc \= '' then
  127. do
  128.   title = "Process Killer"
  129.   classname = 'WPProgram'
  130.   location = '<FM3_Folder>'
  131.   setup = 'EXENAME='curdir'\KILLPROC.EXE;PARAMETERS=%;STARTUPDIR='curdir
  132.   call SysCreateObject classname,title,location,setup,u
  133. end
  134.  
  135. rc = stream('undel.exe','c','query exists')
  136. if rc \= '' then
  137. do
  138.   title = "Undeleter"
  139.   classname = 'WPProgram'
  140.   location = '<FM3_Folder>'
  141.   setup = 'EXENAME='curdir'\UNDEL.EXE;PARAMETERS=%*;STARTUPDIR='curdir
  142.   call SysCreateObject classname,title,location,setup,u
  143. end
  144.  
  145. rc = stream('vtree.exe','c','query exists')
  146. if rc \= '' then
  147. do
  148.   title = "Visual Tree"
  149.   classname = 'WPProgram'
  150.   location = '<FM3_Folder>'
  151.   setup = 'EXENAME='curdir'\VTREE.EXE;STARTUPDIR='curdir
  152.   call SysCreateObject classname,title,location,setup,u
  153. end
  154.  
  155. rc = stream('vdir.exe','c','query exists')
  156. if rc \= '' then
  157. do
  158.   title = "Visual Directory"
  159.   classname = 'WPProgram'
  160.   location = '<FM3_Folder>'
  161.   setup = 'EXENAME='curdir'\VDIR.EXE;PARAMETERS=%*;STARTUPDIR='curdir
  162.   call SysCreateObject classname,title,location,setup,u
  163. end
  164.  
  165. rc = stream('vcollect.exe','c','query exists')
  166. if rc \= '' then
  167. do
  168.   title = "Collector"
  169.   classname = 'WPProgram'
  170.   location = '<FM3_Folder>'
  171.   setup = 'EXENAME='curdir'\VCOLLECT.EXE;STARTUPDIR='curdir
  172.   call SysCreateObject classname,title,location,setup,u
  173. end
  174.  
  175. /*
  176.  * create an FM2.CMD file that the user can copy into a directory
  177.  * in their PATH if they'd like to be able to start FM/2 from any
  178.  * directory via command line.
  179.  */
  180.  
  181. 'del FM2.CMD'
  182. dummy = stream('FM2.CMD','C','open')
  183. if dummy = 'READY:' then
  184. do
  185.   say 'Creating an FM2.CMD file.'
  186.   call lineout 'FM2.CMD', "/* FM/2 command file.  Locate in a directory"
  187.   call lineout 'FM2.CMD', " * on your PATH. */"
  188.   call lineout 'FM2.CMD', "'@echo off'"
  189.   call lineout 'FM2.CMD', "arg dummy"
  190.   call lineout 'FM2.CMD', "if dummy = '' then"
  191.   call lineout 'FM2.CMD', "  curdir = directory()"
  192.   call lineout 'FM2.CMD', "else"
  193.   call lineout 'FM2.CMD', "  curdir = ''"
  194.   call lineout 'FM2.CMD', "n = setlocal()"
  195.   call lineout 'FM2.CMD', "n = directory('"curdir"')"
  196.   call lineout 'FM2.CMD', "'start fm3.exe 'curdir' %1 %2 %3 %4 %5 %6 %7 %8 %9'"
  197.   call lineout 'FM2.CMD', "n = endlocal()"
  198.   call stream 'FM2.CMD','C','close'
  199. end
  200. else say "Couldn't create FM2.CMD file."
  201. say ''
  202.  
  203. /* if we can find FM2.INI, run MIGINI.CMD */
  204.  
  205. fm2ini = value('fm2ini',,'OS2ENVIRONMENT')
  206. if fm2ini \= '' then fm2ini = stream(fm2ini,'c','query exists')
  207. if fm2ini = '' then
  208. do
  209.   fm2ini = value('fm2ini',,'OS2ENVIRONMENT')
  210.   if fm2ini \= '' then
  211.   do
  212.     fm2ini = insert('\FM2.INI',fm2ini,length(fm2ini))
  213.     fm2ini = stream(fm2ini,'c','query exists')
  214.   end
  215. end
  216. fm2ini = SysSearchPath('PATH', 'FM2.INI')
  217. if fm2ini = '' then fm2ini = SysSearchPath('DPATH', 'FM2.INI')
  218. if fm2ini = '' then fm2ini = SysSearchPath('XPATH', 'FM2.INI')
  219. if fm2ini \= '' then
  220. do
  221.   'call migini.cmd dummy'
  222.   say ''
  223.   say '  (You can remove the old FM/2 1.x files when installation completes.)'
  224.   call SysSleep 2
  225.   say ''
  226. end
  227.  
  228. /* type the read.me file just so we're sure user had a _chance_ to see it */
  229.  
  230. /* NOTE:  remove following 4 lines for unattended use... */
  231. rc = stream('install.dat','c','query exists')
  232. if rc \= '' then 'type install.dat'
  233. say 'Press [Enter].'
  234. pull dummy .
  235.  
  236. say 'To move FM/2 to another directory, move the files, delete the FM/2 folder,'
  237. say 'then rerun INSTALL.  To remove FM/2, run UNINSTAL and follow its directions.'
  238. say "If you'd like to be able to run FM2 from any OS/2 command line, copy the"
  239. say 'FM2.CMD file in this directory to a directory on your PATH.'
  240. say ''
  241. say "I'm done now."
  242.  
  243.