home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: Java / Java.zip / javainrt.zip / syslvl.cmd < prev    next >
OS/2 REXX Batch file  |  1998-02-26  |  5KB  |  115 lines

  1. /* rexx */
  2. parse UPPER arg fHandle bootdrive  PATH COMPONENT
  3. file = bootdrive"\kmcrpc10.sl"
  4. tmpfile = test.fi
  5.  
  6. pathlen = LENGTH( PATH)
  7. looking =  SUBSTR(path, 1, pathlen)
  8.  
  9. /* translation strings: */
  10. message1R = "The Java Runtime on the system is newer than the version being installed.  Do you still wish to install the Java Runtime?"
  11. message2R = "You are about to install over an old Beta or Alpha level of Java Runtime.  Do you still wish to install the Java Runtime?"
  12. message1S = "The version of Samples on the system is newer than the version being installed.  Do you still wish to install the Samples component?"
  13. message2S = "You are about to install over an old Beta or Alpha level of Samples.  Do you still wish to install the Samples component?"
  14. message1T = "The version of the Toolkit (JDK) on the system is newer than the version being installed.  Do you still wish to install the Toolkit component?"
  15. message2T = "You are about to install over an old Beta or Alpha level of the Toolkit (JDK).  Do you still wish to install the Toolkit component?"
  16. message1D = "The version of ICATJAVA for OS/2 on the system is newer than the version being installed.  Do you still wish to install the ICATJAVA component?"
  17. message2D = "You are about to install over an old Beta or Alpha level of ICATJAVA for OS/2.  Do you still wish to install the ICATJAVA component?"
  18.  
  19. call RxFuncAdd 'RexxInstResolveVariables', 'WPINSTAL', 'RexxInstResolveVariables'
  20. call RxFuncAdd 'RexxInstSetVariable', 'WPINSTAL', 'RexxInstSetVariable'
  21. call RxFuncAdd 'RexxInstDeselect', 'WPINSTAL', 'RexxInstDeselect'
  22.  
  23. continue = RexxInstResolveVariables( fHandle, "{Continue}", 1)
  24. if continue = "UNATTENDED" then EXIT
  25.  
  26.  
  27. /*       'syslevel > ' file         */
  28. rc = stream( tmpfile, 'c', 'open read')
  29. rc = stream( tmpfile, 'c', 'close')
  30. rc = stream( file, 'c', 'open read')
  31.  
  32. DO while LINES(file)
  33. currline = LINEIN(file)
  34. len = length( currline)
  35. if (len-11) > 0 then check = substr( currline, len-11, 8 )
  36. if check = "SYSLEVEL" then CALL PROCESS
  37. END
  38. EXIT
  39.  
  40.  
  41. PROCESS:
  42.     ext  = substr( currline, len-2, 3 )
  43.     if ext = COMPONENT
  44.          then found =  SUBSTR( currline, 1, pathlen);
  45.          else RETURN;
  46.     PARSE UPPER VAR found found
  47.     if (looking = found) then CALL VERIFY
  48.     RETURN
  49.  
  50. VERIFY:
  51.     nextline = LINEIN(file)
  52.     nextline = LINEIN(file)
  53.     nextline = LINEIN(file)
  54.     len = LENGTH( nextline)
  55.     currentcsd = substr( nextline, len-3, 4)
  56.     if currentcsd = "9999" then CALL 9999;
  57.     else if currentcsd = "4006" then EXIT;
  58.     else if currentcsd >> "4006" then CALL LOWER
  59.     exit
  60.  
  61.  
  62. 9999:   /* ALPHA/BETA level exists:    */
  63.         path = RexxInstResolveVariables( fHandle, "{UserExitPath}", 1)
  64.          if (COMPONENT == "JAV") then
  65.              path'\message' bootdrive fHandle message2R
  66.          else
  67.          if (COMPONENT == "JSP") then
  68.              path'\message' bootdrive fHandle message2S
  69.          else
  70.          if (COMPONENT == "JTK") then
  71.              path'\message' bootdrive fHandle message2T
  72.          else
  73.          if (COMPONENT == "ICA") then
  74.              path'\message' bootdrive fHandle message2D
  75.         continue = RexxInstResolveVariables( fHandle, "{Continue}", 1)
  76.          if continue = "QUIT" then CALL STOP; else EXIT
  77.  
  78.  
  79. LOWER:   /* installing version lower than current version  */
  80.         path = RexxInstResolveVariables( fHandle, "{UserExitPath}", 1)
  81.          if (COMPONENT == "JAV") then
  82.              path'\message' bootdrive fHandle message1R
  83.          else
  84.          if (COMPONENT == "JSP") then
  85.              path'\message' bootdrive fHandle message1S
  86.          else
  87.          if (COMPONENT == "JTK") then
  88.              path'\message' bootdrive fHandle message1T
  89.          else
  90.          if (COMPONENT == "ICA") then
  91.              path'\message' bootdrive fHandle message1D
  92.         continue = RexxInstResolveVariables( fHandle, "{Continue}", 1)
  93.          if continue = "QUIT" then CALL STOP; else EXIT
  94.  
  95.  
  96.  
  97. STOP:
  98.          if (COMPONENT == "JAV") then
  99.          DO
  100.              rc = RexxInstDeselect( fHandle, Runtime);
  101.              keepJAVA11U = RexxInstResolveVariables( fHandle, "{Java11:TlktDocSelected}", 1)
  102.              if ( keepJAVA11U == "NO" )
  103.              then
  104.              rc = RexxInstDeselect( fHandle, Java11U );
  105.          END;
  106.          else
  107.          if (COMPONENT == "JSP") then
  108.              rc = RexxInstDeselect( fHandle, Samples);
  109.          else
  110.          if (COMPONENT == "JTK") then
  111.              rc = RexxInstDeselect( fHandle, Toolkit);
  112.          else
  113.          if (COMPONENT == "ICA") then
  114.              rc = RexxInstDeselect( fHandle, Debugger);
  115.