home *** CD-ROM | disk | FTP | other *** search
/ Power CD-ROM!! 7 / POWERCD7.ISO / os2 / fm2_211 / install.cmd < prev    next >
OS/2 REXX Batch file  |  1994-10-08  |  9KB  |  308 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. say'     ┌───────────────────────────────────────────────────────────────────┐'
  19. say'     │                  FM/2 2.x Installation Program                    │'
  20. say'     │             FM/2 is copyright (c) 1993/94 by M. Kimes             │'
  21. say'     │                       All rights reserved                         │'
  22. say'     ├───────────────────────────────────────────────────────────────────┤'
  23. say'     ├───────────────────────────────────────────────────────────────────┤'
  24. say'     │                Have you read the READ.ME file yet?                │'
  25. say'     │        By running this program, you agree to the license          │'
  26. say'     │                     as specified in that file,                    │'
  27. say'     │      and it tells you how to install, so you should read it.      │'
  28. say'     └───────────────────────────────────────────────────────────────────┘'
  29.  
  30. /*
  31.  * allow user to eliminate associations from being placed on AV/2.
  32.  * seemed to upset some fellow on CIS (I guess he doesn't know about
  33.  * Settings notebooks on WPS objects).
  34.  */
  35. assocfilter = ';ASSOCFILTER=*.ZIP,*.ARC,*.LZH,*.ARJ,*.ZOO,*.MO0'
  36. parse upper arg dummy
  37. if dummy = 'NOASSOC' then assocfilter = ''
  38.  
  39. rc = stream('fm3.exe','c','query exists')
  40. if rc = '' then
  41. do
  42.   say 'Sorry, FM3.EXE not found.  Must not be right directory.  Terminating.'
  43.   exit
  44. end
  45.  
  46. /* tell user what we're doing, give him a chance to hit CTRL-C */
  47.  
  48. say ''
  49. say 'This program creates objects for FM/2.'
  50. say ''
  51.  
  52.  
  53.  
  54. /* NOTE:  remove following 3 lines for unattended use... */
  55. say 'Press [Enter].'
  56. pull dummy .
  57. say ''
  58.  
  59.  
  60. /* save current directory */
  61.  
  62. curdir = directory()
  63.  
  64. /* load rexx utility functions */
  65.  
  66. call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  67. call SysLoadFuncs
  68.  
  69. /* say it, then do it */
  70.  
  71. say "Creating File Manager/2 folder and program objects..."
  72.  
  73. /* first, create FM/2 folder */
  74.  
  75. title = "File Manager/2"
  76. classname = 'WPFolder'
  77. location = '<WP_DESKTOP>'
  78. setup = 'OBJECTID=<FM3_Folder>;OPEN=DEFAULT'
  79. result=SysCreateObject(classname,title,location,setup,f)
  80.  
  81. /* NOTE:  remove following 9 lines for unattended use... */
  82. if result = 0 then
  83. do
  84.   say ''
  85.   say 'The File Manager/2 folder already exists.'
  86.   say 'Should I replace the objects? (Y/N)'
  87.   parse upper pull dummy
  88.   if left(dummy,1) = 'N' then exit
  89.   say ''
  90. end
  91.  
  92. /* now, create program objects in FM/2 folder */
  93.  
  94. title = "File Manager/2"
  95. classname = 'WPProgram'
  96. location = '<FM3_Folder>'
  97. setup = 'EXENAME='curdir'\FM3.EXE;PARAMETERS=%*;STARTUPDIR='curdir
  98. call SysCreateObject classname,title,location,setup,u
  99.  
  100. rc = stream('av2.exe','c','query exists')
  101. if rc \= '' then
  102. do
  103.   title = "Archive Viewer/2"
  104.   classname = 'WPProgram'
  105.   location = '<FM3_Folder>'
  106.   setup = 'EXENAME='curdir'\AV2.EXE;PARAMETERS=%*;STARTUPDIR='curdir''assocfilter
  107.   call SysCreateObject classname,title,location,setup,u
  108. end
  109.  
  110. rc = stream('doicon.exe','c','query exists')
  111. if rc \= '' then
  112. do
  113.   title = "SysIcon"
  114.   classname = 'WPProgram'
  115.   location = '<FM3_Folder>'
  116.   setup = 'EXENAME='curdir'\DOICON.EXE;PARAMETERS=%*;STARTUPDIR='curdir
  117.   call SysCreateObject classname,title,location,setup,u
  118. end
  119.  
  120. rc = stream('eas.exe','c','query exists')
  121. if rc \= '' then
  122. do
  123.   title = "EA Viewer"
  124.   classname = 'WPProgram'
  125.   location = '<FM3_Folder>'
  126.   setup = 'EXENAME='curdir'\EAS.EXE;PARAMETERS=%*;STARTUPDIR='curdir
  127.   call SysCreateObject classname,title,location,setup,u
  128. end
  129.  
  130. rc = stream('ini.exe','c','query exists')
  131. if rc \= '' then
  132. do
  133.   title = "INI Viewer"
  134.   classname = 'WPProgram'
  135.   location = '<FM3_Folder>'
  136.   setup = 'EXENAME='curdir'\INI.EXE;PARAMETERS=%*;STARTUPDIR='curdir';ASSOCFILTER=*.INI'
  137.   call SysCreateObject classname,title,location,setup,u
  138. end
  139.  
  140. rc = stream('viewinfs.exe','c','query exists')
  141. if rc \= '' then
  142. do
  143.   title = "Bookshelf Viewer"
  144.   classname = 'WPProgram'
  145.   location = '<FM3_Folder>'
  146.   setup = 'EXENAME='curdir'\VIEWINFS.EXE;STARTUPDIR='curdir
  147.   call SysCreateObject classname,title,location,setup,u
  148.   title = "Helpfile Viewer"
  149.   classname = 'WPProgram'
  150.   location = '<FM3_Folder>'
  151.   setup = 'EXENAME='curdir'\VIEWINFS.EXE;PARAMETERS=DUMMY;STARTUPDIR='curdir
  152.   call SysCreateObject classname,title,location,setup,u
  153. end
  154.  
  155. rc = stream('killproc.exe','c','query exists')
  156. if rc \= '' then
  157. do
  158.   title = "Process Killer"
  159.   classname = 'WPProgram'
  160.   location = '<FM3_Folder>'
  161.   setup = 'EXENAME='curdir'\KILLPROC.EXE;PARAMETERS=%;STARTUPDIR='curdir
  162.   call SysCreateObject classname,title,location,setup,u
  163. end
  164.  
  165. rc = stream('undel.exe','c','query exists')
  166. if rc \= '' then
  167. do
  168.   title = "Undeleter"
  169.   classname = 'WPProgram'
  170.   location = '<FM3_Folder>'
  171.   setup = 'EXENAME='curdir'\UNDEL.EXE;PARAMETERS=%*;STARTUPDIR='curdir
  172.   call SysCreateObject classname,title,location,setup,u
  173. end
  174.  
  175. rc = stream('vtree.exe','c','query exists')
  176. if rc \= '' then
  177. do
  178.   title = "Visual Tree"
  179.   classname = 'WPProgram'
  180.   location = '<FM3_Folder>'
  181.   setup = 'EXENAME='curdir'\VTREE.EXE;STARTUPDIR='curdir
  182.   call SysCreateObject classname,title,location,setup,u
  183. end
  184.  
  185. rc = stream('vdir.exe','c','query exists')
  186. if rc \= '' then
  187. do
  188.   title = "Visual Directory"
  189.   classname = 'WPProgram'
  190.   location = '<FM3_Folder>'
  191.   setup = 'EXENAME='curdir'\VDIR.EXE;PARAMETERS=%*;STARTUPDIR='curdir
  192.   call SysCreateObject classname,title,location,setup,u
  193. end
  194.  
  195. rc = stream('vcollect.exe','c','query exists')
  196. if rc \= '' then
  197. do
  198.   title = "Collector"
  199.   classname = 'WPProgram'
  200.   location = '<FM3_Folder>'
  201.   setup = 'EXENAME='curdir'\VCOLLECT.EXE;STARTUPDIR='curdir
  202.   call SysCreateObject classname,title,location,setup,u
  203. end
  204.  
  205. rc = stream('READ.ME','c','query exists')
  206. if rc \= '' then
  207. do
  208.   title = "Read.Me"
  209.   classname = 'WPShadow'
  210.   location = '<FM3_Folder>'
  211.   setup = 'SHADOWID='rc
  212.   call SysCreateObject classname,title,location,setup,u
  213. end
  214.  
  215. rc = stream('REGISTER.TXT','c','query exists')
  216. if rc \= '' then
  217. do
  218.   title = "Register.Txt"
  219.   classname = 'WPShadow'
  220.   location = '<FM3_Folder>'
  221.   setup = 'SHADOWID='rc
  222.   call SysCreateObject classname,title,location,setup,u
  223. end
  224.  
  225. rc = stream('ASSOCIAT.TXT','c','query exists')
  226. if rc \= '' then
  227. do
  228.   title = "Associat.Txt"
  229.   classname = 'WPShadow'
  230.   location = '<FM3_Folder>'
  231.   setup = 'SHADOWID='rc
  232.   call SysCreateObject classname,title,location,setup,u
  233. end
  234.  
  235. /*
  236.  * create an FM2.CMD file that the user can copy into a directory
  237.  * in their PATH if they'd like to be able to start FM/2 from any
  238.  * directory via command line.
  239.  */
  240.  
  241. 'del FM2.CMD'
  242. dummy = stream('FM2.CMD','C','open')
  243. if dummy = 'READY:' then
  244. do
  245.   say 'Creating an FM2.CMD file.'
  246.   call lineout 'FM2.CMD', "/* FM/2 command file.  Locate in a directory"
  247.   call lineout 'FM2.CMD', " * on your PATH. */"
  248.   call lineout 'FM2.CMD', "'@echo off'"
  249.   call lineout 'FM2.CMD', "arg dummy"
  250.   call lineout 'FM2.CMD', "if dummy = '' then"
  251.   call lineout 'FM2.CMD', "  curdir = directory()"
  252.   call lineout 'FM2.CMD', "else"
  253.   call lineout 'FM2.CMD', "  curdir = ''"
  254.   call lineout 'FM2.CMD', "n = setlocal()"
  255.   call lineout 'FM2.CMD', "n = directory('"curdir"')"
  256.   call lineout 'FM2.CMD', "'start fm3.exe 'curdir' %1 %2 %3 %4 %5 %6 %7 %8 %9'"
  257.   call lineout 'FM2.CMD', "n = endlocal()"
  258.   call stream 'FM2.CMD','C','close'
  259. end
  260. else say "Couldn't create FM2.CMD file."
  261. say ''
  262.  
  263. rc = stream('fm3.ini','c','query exists')
  264. if rc \= '' then
  265.   say 'An FM3.INI exists -- not attempting to migrate 1.x information.'
  266. else
  267. do
  268.   /* if we can find FM2.INI, run MIGINI.CMD */
  269.   fm2ini = value('fm2ini',,'OS2ENVIRONMENT')
  270.   if fm2ini \= '' then fm2ini = stream(fm2ini,'c','query exists')
  271.   if fm2ini = '' then
  272.   do
  273.     fm2ini = value('fm2ini',,'OS2ENVIRONMENT')
  274.     if fm2ini \= '' then
  275.     do
  276.       fm2ini = insert('\FM2.INI',fm2ini,length(fm2ini))
  277.       fm2ini = stream(fm2ini,'c','query exists')
  278.     end
  279.   end
  280.   fm2ini = SysSearchPath('PATH', 'FM2.INI')
  281.   if fm2ini = '' then fm2ini = SysSearchPath('DPATH', 'FM2.INI')
  282.   if fm2ini = '' then fm2ini = SysSearchPath('XPATH', 'FM2.INI')
  283.   if fm2ini \= '' then
  284.   do
  285.     'call migini.cmd dummy'
  286.     say ''
  287.     say '  (You can remove the old FM/2 1.x files when installation completes.)'
  288.     call SysSleep 2
  289.     say ''
  290.   end
  291. end
  292.  
  293. /* type the install.dat file to show any critical info/notices */
  294.  
  295. /* NOTE:  remove following 4 lines for unattended use... */
  296. rc = stream('install.dat','c','query exists')
  297. if rc \= '' then 'type install.dat'
  298. say 'Press [Enter].'
  299. pull dummy .
  300.  
  301. say 'To move FM/2 to another directory, move the files, delete the FM/2 folder,'
  302. say 'then rerun INSTALL.  To remove FM/2, run UNINSTAL and follow its directions.'
  303. say "If you'd like to be able to run FM/2 from any OS/2 command line, copy the"
  304. say 'FM2.CMD file in this directory to a directory on your PATH.'
  305. say ''
  306. say "I'm done now."
  307.  
  308.