home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / texed133.zip / English.zip / Install.cmd < prev    next >
OS/2 REXX Batch file  |  1995-10-15  |  5KB  |  164 lines

  1. /* Install.cmd */
  2.  
  3. call RxFuncAdd SysLoadFuncs, RexxUtil, SysLoadFuncs
  4. call SysLoadFuncs
  5.  
  6. /*
  7.  *  Get the TeX environments and set the installation paths
  8.  */
  9.     env = VALUE('emtexdir',,'OS2ENVIRONMENT')
  10.     env2 = Left( env, 2)
  11.  
  12.     Pfad.0 = 3
  13.     if SysIni( "USER", "TeXEditor", "Pfad" ) \= 'ERROR:' then
  14.     Pfad.1 = SysIni( "USER", "TeXEditor", "Pfad" )
  15.     else
  16.     Pfad.1 = env2||"\TeXEdit"
  17.     Pfad.2 = env"\DLL"
  18.     Pfad.3 = env||'\book'
  19.  
  20. /*
  21.  *  Installation procedure
  22.  */
  23.     cls
  24.     say '                            FSS - TeX Editor'
  25.     say '                              Installation  '
  26.     say
  27.     say
  28.     say 'Welcome to FSS-TexEdit.'
  29.     say
  30.     say 'During the installation procedure you have to enter some'
  31.     say 'path informations. Please enter all paths without an ending'
  32.     say 'backslash (\).'
  33.     say
  34.  
  35.     say
  36.     say 'Installation path for TeXEdit?'
  37.     say '[Press ENTER for :'||Pfad.1||']'
  38.     parse pull tmp
  39.     if tmp \= '' then Pfad.1 = tmp
  40.     ok = SysIni( "USER", "TeXEditor", "Pfad", Pfad.1 )
  41.  
  42.     say
  43.     say 'Installation path for the DLL files?'
  44.     say '[Press ENTER for :'||Pfad.2||']'
  45.     parse pull tmp
  46.     if tmp \= '' then Pfad.2 = tmp
  47.  
  48.     say
  49.     say 'Installation path for the INF files?'
  50.     say '[Press ENTER for :'||Pfad.3||']'
  51.     parse pull tmp
  52.     if tmp \= '' then Pfad.3 = tmp
  53.  
  54.     do i = 1 to Pfad.0
  55.     call SysFileTree Pfad.i, 'tmp', 'D'
  56.     if tmp.0 = 0 then do
  57.         ok = SysMkDir(Pfad.i)
  58.         if ok \= 0 then do
  59.         say 'ERROR: Directory '||Pfad.i||'could not be created.'
  60.         exit
  61.         end
  62.     end
  63.     end
  64.  
  65.     Datei.0 = 6
  66.     Datei.1 = '*.exe'
  67.     Datei.2 = '*.txt'
  68.     Datei.3 = '*.cmd'
  69.     Datei.4 = '*.ico'
  70.     Datei.5 = '*.bmp'
  71.     Datei.6 = '*.cmd'
  72.  
  73.     do i = 1 to Datei.0
  74.     '@copy '||Datei.i||' '||Pfad.1
  75.     end
  76.  
  77.     '@copy *.dll '||Pfad.2
  78.     '@copy *.inf '||Pfad.3
  79.  
  80.  
  81. /*
  82.  *  Create the objects on the desktop
  83.  */
  84.     say
  85.     say 'Please choose a startup directory for TeXEdit? [ENTER for none]'
  86.     parse pull StartUpDir
  87.  
  88.     object.0 = 6
  89.     object.1 = 'EXENAME='||Pfad.1||'\TeXEdit.exe;STARTUPDIR='||StartUpDir
  90.     object.2 = 'EXENAME='||Pfad.1||'\TeXEdit.exe;STARTUPDIR='||StartUpDir||';PARAMETERS=-p'
  91.     object.3 = 'EXENAME=View.exe;PARAMETERS=TeXEdit.INF'
  92.     object.4 = 'EXENAME=e.exe;PARAMETERS='||Pfad.1||'\New.txt'
  93.     object.5 = 'EXENAME='||Pfad.1||'\Register.exe'
  94.     object.6 = 'EXENAME=e.exe;PARAMETERS='||Pfad.1||'\Register.txt'
  95.  
  96.     caption.1 = 'TeXEditor'
  97.     caption.2 = 'PreLoad'
  98.     caption.3 = 'Help'
  99.     caption.4 = 'New'
  100.     caption.5 = 'Register'
  101.     caption.6 = 'Registration form'
  102.  
  103.     if SysCreateObject("WPFolder", "FSS-TeXEditor", "<WP_DESKTOP>",,
  104.     "OBJECTID=<MEINORDNER>") Then nop
  105.     do i = 1 to object.0
  106.     If SysCreateObject("WPProgram", caption.i, "<MEINORDNER>",,
  107.         object.i)  Then a = 1
  108.     end
  109.     If SysCreateObject("WPProgram", "TeXEditor", "<MEINORDNER>",,
  110.     'ASSOCFILTER=*.TEX,*.TEV', "update" )  Then a = 1
  111.  
  112.     say
  113.     say 'The following environment have to be add to your CONFIG.SYS:'
  114.     say '   '||Pfad.1||' will be added to <path>.'
  115.     say '   '||Pfad.2||' will be added to <libpath>.'
  116.     say '   '||Pfad.3||' will be added to <bookshelf>.'
  117.     say 'Should the installation programm add these environments? [y|n]'
  118.     pull char
  119.     if char = 'N' then exit
  120.  
  121. /*
  122.  *  Modify the CONFIG.SYS
  123.  */
  124.     env = VALUE('USER_INI',,'OS2ENVIRONMENT')
  125.     env = Left( env, 2)
  126.  
  127.     search.0 = 3
  128.     search.1 = 'SET PATH'
  129.     search.3 = 'SET BOOKSHELF'
  130.     search.2 = 'LIBPATH'
  131.  
  132.     do while lines( env||'\config.sys') > 0
  133.     line = LineIn( env||'\config.sys')
  134.     tmp = TRANSLATE( line)
  135.     do i = 1 to search.0
  136.         if pos( search.i, tmp) > 0 then do
  137.         pos = Pos( TRANSLATE( Pfad.i)||';', tmp)
  138.         if pos = 0 then do
  139.             do while (Right( tmp, 1) = ' ') | (Right( tmp, 1) = ';')
  140.             l = length(tmp)
  141.             tmp = SubStr(tmp, 1, l - 1)
  142.             line = SubStr(line, 1, l - 1)
  143.             end
  144.             line = line||';'||Pfad.i||';'
  145.         end
  146.         end
  147.     end
  148.     call LineOut env||'\config.new', line
  149.     end
  150.     call LineOut env||'\config.sys'
  151.     call LineOut env||'\config.new'
  152.  
  153.     '@copy '||env||'\config.sys '||env||'\config.old'
  154.     '@copy '||env||'\config.new '||env||'\config.sys'
  155.     '@del '||env||'\config.new'
  156.  
  157.     cls
  158.     say
  159.     say 'Your CONFIG.SYS was saved as CONFIG.OLD.'
  160.     say
  161.     say 'Please reboot your computer to make the new environment valid.'
  162.  
  163. /* End of Install.cmd */
  164.