home *** CD-ROM | disk | FTP | other *** search
/ The Developer Connection…ice Driver Kit for OS/2 3 / DEV3-D1.ISO / install / epminst.cmd < prev    next >
Encoding:
Text File  |  1994-03-01  |  5.8 KB  |  153 lines

  1. /***********************************************************************/
  2. /* EPM Installation Tool                                               */
  3. /*                                                                     */
  4. /* Handles all installation tasks for EPM.  Locked files are not       */
  5. /* handled.                                                            */
  6. /*                                                                     */
  7. /***********************************************************************/
  8. /*                 (C) Copyright IBM Corporation 1994                  */
  9. /***********************************************************************/
  10.  
  11. parse upper arg BDr CDr .
  12. trace 'o'
  13.  
  14. call Initialize
  15.  
  16. 'cls'
  17. say
  18. say '┌────────────────────────────────────────────────────────────────────────────┐'
  19. say '│                        The Developer Connection                            │'
  20. say '│                 Enhanced Editor ver. 5.51 Installation                     │'
  21. say '│                  (C) Copyright IBM Corporation 1994                        │'
  22. say '├────────────────────────────────────────────────────────────────────────────┤'
  23. say '│                            **  Warning **                                  │'
  24. say '│   If the current version of EPM is installed on your system, it will be    │'
  25. say '│   upgraded to ver 5.51.  Also, many sample macros will be installed in     │'
  26. say '│   the E_MACROS directory added to your EPMPATH in CONFIG.SYS.              │'
  27. say '│                                                                            │'
  28. say '│                 Type [Q] to Quit or [ENTER] to continue.                   │'
  29. say '│                                                                            │'
  30. say '└────────────────────────────────────────────────────────────────────────────┘'
  31. answer = translate(linein(STDIN))
  32. if answer = 'Q'
  33.   then do
  34.       call 'MessageBox' 'EPM', 'Installation aborted by user.'
  35.     exit 0
  36.   end  /* Do */
  37.  
  38. /* Check EPMPATH and Add OS2\APPS\E_MACROS */
  39. size = stream(BDr'\CONFIG.SYS', 'C', 'QUERY SIZE')
  40. data = charin(BDr'\CONFIG.SYS', '1', size)
  41. temp = stream(BDr'\CONFIG.SYS', 'C', 'CLOSE')
  42.  
  43. num  = 0
  44. do while length(data) <> 0
  45.   num = num + 1
  46.   parse var data line.num'0d0a'x rest
  47.   data = rest
  48. end /* do */
  49. line.0 = num
  50.  
  51. hits.=0
  52. num2 = 0
  53. do num = 1 to line.0
  54.   if pos('SET EPMPATH', line.num) <> 0
  55.     then do
  56.       num2 = num2 + 1
  57.       hits.num2 = num line.num
  58.     end /* Do */
  59. end /* do */
  60.  
  61. hits.0 = num2
  62. if hits.0 = 0
  63.   then Resp = LINEOUT(BDr'\CONFIG.SYS', 'SET EPMPATH='BDr'\OS2\APPS;'BDr'\OS2\APPS\E_MACROS;')
  64.   else do
  65.     dirty = 0
  66.     do num = 1 to hits.0
  67.       parse var hits.num linenum .
  68.       if right(line.linenum,1) <> ';'
  69.         then line.linenum = line.linenum';'
  70.       if pos('OS2\APPS\E_MACROS', line.linenum) = 0
  71.         then do
  72.           line.linenum = line.linenum||BDr'\OS2\APPS\E_MACROS;'
  73.           dirty = 1
  74.         end /* Do */
  75.     end /* do */
  76.     if dirty
  77.       then do
  78.         '@ECHO OFF'
  79.         'copy 'BDr'\CONFIG.SYS 'BDr'\CONFIG.BAK >nul 2>nul'
  80.         'erase 'BDr'\CONFIG.SYS'
  81.         do num = 1 to line.0
  82.           Resp = lineout(BDr'\CONFIG.SYS', line.num)
  83.         end /* Do */
  84.       end /* Do */
  85.     end /* Do */
  86.  
  87. /* Use PACKINST.CMD to install all packages. */
  88. say '┌────────────────────────────────────────────────────────────────────────────┐'
  89. say '│          Updating EPM Executable files to the OS2\APPS directory.          │'
  90. say '└────────────────────────────────────────────────────────────────────────────┘'
  91. '@XCOPY 'CDr'EDITORS\EPM\APPS 'BDr'\OS2\APPS\*.* /s /e >nul 2>nul'
  92. resp = rc
  93. if resp = 0
  94.   then do
  95.     say '┌────────────────────────────────────────────────────────────────────────────┐'
  96.     say '│            Updating EPM DLL files to the OS2\APPS\DLL directory.           │'
  97.     say '└────────────────────────────────────────────────────────────────────────────┘'
  98.     '@XCOPY 'CDr'EDITORS\EPM\DLL 'BDr'\OS2\APPS\DLL\*.* /s /e >nul 2>nul'
  99.     resp = rc
  100.   end
  101.   else call MyExit resp
  102. if resp = 0
  103.   then do
  104.     say '┌────────────────────────────────────────────────────────────────────────────┐'
  105.     say '│           Updating EPM HELP files to the OS2\HELP directory.               │'
  106.     say '└────────────────────────────────────────────────────────────────────────────┘'
  107.     '@XCOPY 'CDr'EDITORS\EPM\HELP 'BDr'\OS2\HELP\*.*  /s /e > nul 2>nul'
  108.     resp = rc
  109.   end
  110.   else call MyExit resp
  111. if resp = 0
  112.   then do
  113.     say '┌────────────────────────────────────────────────────────────────────────────┐'
  114.     say '│             Updating EPM BOOK files to the OS2\BOOK directory.             │'
  115.     say '└────────────────────────────────────────────────────────────────────────────┘'
  116.     '@XCOPY 'CDr'EDITORS\EPM\BOOK 'BDr'\OS2\BOOK\*.* /s /e >nul 2>nul'
  117.     resp = rc
  118.   end
  119.   else call MyExit resp
  120. if resp = 0
  121.   then do
  122.     say '┌────────────────────────────────────────────────────────────────────────────┐'
  123.     say '│       Updating EPM Macro files to the OS2\APPS\E_MACROS directory.         │'
  124.     say '└────────────────────────────────────────────────────────────────────────────┘'
  125.     '@XCOPY 'CDr'EDITORS\EPM\E_MACROS 'BDr'\OS2\APPS\E_MACROS\*.*  /s /e >nul 2>nul'
  126.     resp = rc
  127.   end
  128.   else call MyExit resp
  129.  
  130. call 'MessageBox' 'EPM', 'Upgrade of the Enhanced Editor for OS/2 was successful.',
  131.       'You may try this application without rebooting your system.'
  132. call 'CaddComplete' 0
  133. call 'CaddExit'
  134. exit
  135.  
  136. Initialize:
  137. CurDir = directory()
  138. call directory CDr'INSTALL'
  139. call Rxfuncadd 'CADDINIT', 'RXCADD', 'CADDINIT'
  140. signal on syntax
  141. ver = 'CAddInit'()
  142. signal off syntax
  143. if abbrev(ver, 'ERROR:')
  144.   then call syntax
  145. return 0
  146.  
  147.  
  148. MyExit:
  149. call beep 300, 150
  150. call 'MessageBox' 'EPM', 'Installation failed. You may be running another EPM editor!'
  151. call 'CaDDExit'
  152. exit 0
  153.