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