home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / edispm11.zip / EDisPM / BIN / INSTALL.CMD < prev    next >
OS/2 REXX Batch file  |  1995-09-27  |  8KB  |  274 lines

  1. /* EDisPM - Installation mittels REXX */
  2. '@Echo Off'
  3. Call RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs'
  4. Call SysLoadFuncs
  5. Signal On Failure Name FAILURE
  6. Signal On Halt Name HALT
  7. Signal On Syntax Name SYNTAX
  8. Call SysCls
  9. say '-------------------------------'
  10. say '---- EDisPM - Installation ----'
  11. say '-------------------------------'
  12. say ''
  13. Result = SysFileTree( 'EDISPM.EXE', 'Files', 'F' )
  14. If Files.0 = 0 Then
  15.   Do
  16.   Say 'Fehler: EDISPM.EXE nicht gefunden! Installation abgebrochen.'
  17.   Signal DONE
  18.   End
  19. Result = SysFileTree( 'EDISPM.IR', 'Files', 'F' )
  20. If Files.0 = 0 Then
  21.   Do
  22.   Say 'Fehler: EDISPM.IR nicht gefunden! Installation abgebrochen.'
  23.   Signal DONE
  24.   End
  25. Result = SysFileTree( 'EDISSERV.DLL', 'Files', 'F' )
  26. If Files.0 = 0 Then
  27.   Do
  28.   Say 'Fehler: EDISSERV.DLL nicht gefunden! Installation abgebrochen.'
  29.   Signal DONE
  30.   End
  31. Result = SysFileTree( 'EDISPM.INF', 'Files', 'F' )
  32. If Files.0 = 0 Then
  33.   Do
  34.   Say 'Fehler: EDISPM.INF nicht gefunden! Installation abgebrochen.'
  35.   Signal DONE
  36.   End
  37. Result = SysFileTree( 'README.TXT', 'Files', 'F' )
  38. If Files.0 = 0 Then
  39.   Do
  40.   Say 'Fehler: README.TXT nicht gefunden! Installation abgebrochen.'
  41.   Signal DONE
  42.   End
  43. Result = SysFileTree( 'STARTEDS.CMD', 'Files', 'F' )
  44. If Files.0 = 0 Then
  45.   Do
  46.   Say 'Fehler: STARTEDS.CMD nicht gefunden! Installation abgebrochen.'
  47.   Signal DONE
  48.   End
  49. Say 'Bitte geben Sie den vollen Namen des Verzeichnisses an, in dem der'
  50. Say 'verteilte Editor EDisPM installiert werden soll (default C:\EDISPM): '
  51. Pull Directory
  52. If Directory = "" Then Directory = 'C:\EDISPM'
  53. Result = SysFileTree( Directory, 'Dirs', 'D' )
  54. If Dirs.0 = 0 Then
  55.   Do
  56.   Result = SysMkDir( Directory )
  57.   if Result == 0 Then
  58.     Do
  59.     End
  60.   Else
  61.     Do
  62.     Say 'Fehler: Das Zielverzeichnis kann nicht erstellt werden. Installation abgebrochen.'
  63.     Signal DONE
  64.     End
  65.   End
  66. Say ''
  67. Say 'Die Programmdateien werden kopiert...'
  68.  
  69. Say ''
  70. Say 'Kopiere EDisPM.EXE nach' Directory '...'
  71. Copy EDisPM.EXE Directory                  '1>NUL'
  72. Say 'Kopiere EDisPM.IR nach' Directory '...'
  73. Copy EDisPM.IR Directory                  '1>NUL'
  74. Say 'Kopiere EDisServ.DLL nach' Directory '...'
  75. Copy EDisServ.DLL Directory                  '1>NUL'
  76. Say 'Kopiere EDisPM.INF nach' Directory '...'
  77. Copy EDisPM.INF Directory                  '1>NUL'
  78. Say 'Kopiere INSTALL.CMD nach' Directory '...'
  79. Copy INSTALL.CMD Directory                  '1>NUL'
  80. Say 'Kopiere README.TXT nach' Directory '...'
  81. Copy README.TXT Directory                  '1>NUL'
  82. Say 'Kopiere STARTEDS.CMD nach' Directory '...'
  83. Copy STARTEDS.CMD Directory                  '1>NUL'
  84. Say ''
  85. Say 'Erstelle Programmobjekte im neuen Ordner EDisPM...'
  86. Say ''
  87. if SysCreateObject("WPFolder", "EDisPM", "<WP_DESKTOP>", "OBJECTID=<ED_ORDNER>") then
  88.    do
  89.    Folder = '<ED_ORDNER>'
  90.    Type = 'WPProgram'
  91.    Title = 'EDisPM Client'
  92.    Parms = 'MINWIN=DESKTOP;PROGTYPE=PM;CCVIEW=YES;EXENAME='Directory'\EDisPM.EXE;STARTUPDIR='Directory';OBJECTID=<EDISPM>;NOPRINT=YES;'
  93.    Result = SysCreateObject( Type, Title, Folder, Parms, 'ReplaceIfExists' )
  94.    If Result = 1 Then
  95.      do
  96.      Type = 'WPShadow'
  97.      Title = 'EDisPM Online'
  98.      Parms = 'SHADOWID='Directory'\EDISPM.INF'
  99.      Result = SysCreateObject( Type, Title, Folder, Parms, 'ReplaceIfExists' )
  100.      If Result = 1 Then
  101.        do
  102.        Type = 'WPProgram'
  103.        Title = 'EDisPM Server (somdd)'
  104.        Parms = 'MINWIN=DESKTOP;PROGTYPE=WINDOWABLEVIO;MINIMIZED=YES;EXENAME='Directory'\STARTEDS.CMD;STARTUPDIR='Directory';OBJECTID=<STARTEDS>;NOPRINT=YES;'
  105.        Result = SysCreateObject( Type, Title, Folder, Parms, 'ReplaceIfExists' )
  106.        If Result = 1 Then
  107.           do
  108.           Say 'Der verteilte Editor EDisPM wurde erfolgreich installiert.'
  109.           Say ''
  110.           Say 'Die Datei >EDISPM.IR< wird an den DSOM Interface Repository Suchpfad'
  111.           Say 'in der CONFIG.SYS angehängt.'
  112.           Say ''
  113.           Call UpdateConfigSys
  114.           Exit
  115.           end
  116.        end
  117.      end
  118.    end
  119.  
  120. Say 'Fehler: Objekte können nicht erstellt werden. Installation abgebrochen.'
  121. Exit
  122.  
  123. FAILURE:
  124. Say 'Installationsfehler.'
  125. Signal DONE
  126. HALT:
  127. Say 'Installationsfehler.'
  128. Signal DONE
  129. SYNTAX:
  130. Say 'Installationsfehler.'
  131. Signal DONE
  132. DONE:
  133. Exit
  134.  
  135. /***************************/
  136. /* Change the CONFIG.SYS   */
  137. /***************************/
  138.  
  139. UpdateConfigSys:   /* change the config.sys file for IBMWorks */
  140. /*
  141. '@cls'
  142. response=''
  143.  
  144. Say '    Do you want to update 'bootdrive'\CONFIG.SYS?(Y/N)'
  145.   Parse Upper Pull response
  146.   If response <> 'N' Then Do
  147.      Say '    The old 'bootdrive'\CONFIG.SYS will be created called 'bootdrive'\CONFIG.IW'
  148.      Say ' '
  149.      Say '    Shutdown and restart your system for these changes to take affect.'
  150.      Say ' '
  151.   End
  152.   Else
  153.      return 0
  154. */
  155.  
  156.  
  157. bootdrive = Substr(Translate(Value('PATH',,'OS2ENVIRONMENT')),Pos('\OS2\SYSTEM',Translate(Value('PATH',,'OS2ENVIRONMENT')))-2,2)
  158.  
  159. oldconfig=bootdrive'\CONFIG.SYS'
  160. newconfig=bootdrive'\CONFIG.ED'
  161. tmpconfig=bootdrive'\ED.SYS'
  162.  
  163. os2somir='SET SOMIR'
  164.  
  165. iniflag=0
  166.  
  167. /*
  168.  * read the file one line at a time, and write it all out, making
  169.  * changes accordingly - need to change path, libpath, help, IBMWORKS_INI
  170.  */
  171.  
  172. '@del 'newconfig ' 2>nul >nul'
  173.  
  174. Do while lines(oldconfig)
  175.     inline=linein(oldconfig)
  176.  
  177.     /******************************************/
  178.     /* parse the line into variable and value */
  179.     /******************************************/
  180.  
  181.     parse value inline with os2var '=' os2value
  182.  
  183.     /********************************************************/
  184.     /* translate the variable into uppercase for comparison */
  185.     /********************************************************/
  186.  
  187.     os2var=translate(os2var)
  188.     Select
  189.  
  190.         /********************************************************/
  191.         /*          For SOMIR                                   */
  192.         /********************************************************/
  193.         when os2var=os2somir Then Do
  194.             ibmwline=inline
  195.  
  196.             /* see if path is already set */
  197.             k = pos('EDISPM.IR', translate(ibmwline))
  198.             If k = 0 Then Do
  199.                /*
  200.                 * see if there is a ; at the end of the value
  201.                 */
  202.                position=lastpos(';',os2value)
  203.                lenvalue=length(os2value)
  204.  
  205.                If position=lenvalue Then do
  206.                    /* ; at end of value */
  207.                    ibmwline=os2var'='os2value''Directory'\EDISPM.IR;'
  208.                End
  209.                Else Do
  210.                    /* ; NOT at end of value */
  211.                    ibmwline=os2var'='os2value';'Directory'\EDISPM.IR;'
  212.                End
  213.             End
  214.             /*
  215.              * write the line out to the new config file
  216.              */
  217.  
  218.             result=lineout(newconfig, ibmwline)
  219.  
  220.             If result=1 Then Do
  221.                 writeerror()
  222.                 return 1
  223.             End
  224.         End
  225.  
  226.         otherwise Do
  227.             /*
  228.              * write the line out to the new config file
  229.              */
  230.  
  231.             result=lineout(newconfig, inline)
  232.             If result=1 Then Do
  233.                 writeerror()
  234.                 return 1
  235.             End
  236.         End
  237.  
  238.     End  /* select */
  239.  
  240. End /* Do */
  241.  
  242. /*********************/
  243. /* close the files   */
  244. /*********************/
  245.  
  246. result=lineout(newconfig)
  247. result=lineout(oldconfig)
  248.  
  249. /********************************************************************/
  250. /* Copy created file(CONFIG.IW) to temporary file(IWTMP.SYS),       */
  251. /* copy original file(CONFIG.SYS) to new file(CONFIG.IW),           */
  252. /* and copy temporary file(IWTMP.SYS) to original file(CONFIG.SYS). */
  253. /********************************************************************/
  254.  
  255. '@copy 'oldconfig' 'tmpconfig' 2>nul >nul'
  256.  
  257. '@copy 'newconfig' 'oldconfig' 2>nul >nul'
  258.  
  259. '@copy 'tmpconfig' 'newconfig' 2>nul >nul'
  260.  
  261. '@del 'tmpconfig' 2>nul >nul'
  262.  
  263. /******************************************************************/
  264. /*  Finished the Update                                           */
  265. /******************************************************************/
  266.  
  267. rem Say ' '
  268. rem Say '               'bootdrive'\CONFIG.SYS erfolgreich upgedated.'
  269. rem Say ' '
  270.  
  271. return 0
  272.  
  273.  
  274.