home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: Java / Java.zip / javainrt.zip / precheck.cmd < prev    next >
OS/2 REXX Batch file  |  1998-05-18  |  9KB  |  214 lines

  1. /* rexx */
  2.  
  3. /* Load external FI API
  4. */
  5. call RxFuncAdd 'RexxInstSetVariable', 'WPINSTAL', 'RexxInstSetVariable'
  6. call RxFuncAdd 'RexxInstResolveVariables', 'WPINSTAL', 'RexxInstResolveVariables'
  7. call RxFuncAdd 'RexxInstDeselect', 'WPINSTAL', 'RexxInstDeselect'
  8. call RxFuncAdd 'RexxInstSelect', 'WPINSTAL', 'RexxInstSelect'
  9.  
  10. /* Get the objectid (feature handle), and the current package from the arguments
  11. */
  12. parse arg objectid package
  13.  
  14. /* Determine if we will check the runtime checkbox and feature
  15. */
  16. RTChecked = 0
  17.  
  18. /* Check for a syslevel file and the correct version
  19. */
  20. if ReadSysLevel(package"\syslevel.jav")  then do
  21.    if st.bSysVersion = 11 & st.bSysModify = 6 then do
  22.       call RexxInstSetVariable objectid,"Runtime" ,"CheckableRT","1"
  23.       call RexxInstSelect objectid,"Runtime"
  24.       call RexxInstSelect objectid,"RuntimeConfig"
  25.       call RexxInstSelect objectid,"Unicode"
  26.       call RexxInstSelect objectid,"UnicodeConfig"
  27.  
  28.       call RexxInstSetVariable objectid,"Runtime.Visible" ,"CheckableRT","1"
  29.       call RexxInstSelect objectid,"Runtime.Visible"
  30.       RTChecked = 1
  31.    end
  32.    else do
  33.       call RexxInstSetVariable objectid,"Runtime" ,"CheckableRT","0"
  34.       call RexxInstDeSelect objectid,"Runtime"
  35.       call RexxInstDeSelect objectid,"RuntimeConfig"
  36.       call RexxInstDeSelect objectid,"Unicode"
  37.       call RexxInstDeSelect objectid,"UnicodeConfig"
  38.  
  39.       call RexxInstSetVariable objectid,"Runtime.Visible" ,"CheckableRT","0"
  40.       call RexxInstDeSelect objectid,"Runtime.Visible"
  41.    end
  42. end
  43. else do
  44.    call RexxInstSetVariable objectid,"Runtime" ,"CheckableRT","0"
  45.    call RexxInstDeSelect    objectid,"Runtime"
  46.    call RexxInstDeSelect    objectid,"RuntimeConfig"
  47.    call RexxInstDeSelect    objectid,"Unicode"
  48.    call RexxInstDeSelect    objectid,"UnicodeConfig"
  49.  
  50.    call RexxInstSetVariable objectid,"Runtime.Visible" ,"CheckableRT","0"
  51.    call RexxInstDeSelect    objectid,"Runtime.Visible"
  52. end
  53.  
  54. /* See if the user already has the correct Runtime installed
  55. */
  56. RTInstalled = 0
  57. InstalledVersion = RexxInstResolveVariables(objectid, "{INV_Runtime:VersionNumber}", 0)
  58. CurrentVersion   = RexxInstResolveVariables(objectid, "{Runtime:VersionNumber}", 0)
  59. if InstalledVersion = CurrentVersion then do
  60.    RTInstalled = 1
  61. end
  62.  
  63. /* Set variable for response file dependency checking
  64. */
  65. call RexxInstSetVariable objectid,"Java11" ,"RTInstalled", RTInstalled
  66.  
  67. /* Determine if we will check the toolkit, samples and debugger checkboxs and features
  68. */
  69. /* Check for a syslevel file and the correct version
  70. */
  71. if ReadSysLevel(package"\syslevel.jtk")  then do
  72.    if (st.bSysVersion = 11) & (st.bSysModify = 6) & (RTChecked | RTInstalled) then do
  73.       call RexxInstSetVariable objectid,"Toolkit" ,"CheckableTK","1"
  74.       call RexxInstSelect      objectid,"Toolkit"
  75.       call RexxInstSelect      objectid,"ToolkitConfig"
  76.  
  77.       call RexxInstSetVariable objectid,"Samples" ,"CheckableSM","1"
  78.       call RexxInstSelect      objectid,"Samples"
  79.       call RexxInstSelect      objectid,"SamplesConfig"
  80.  
  81.       call RexxInstSetVariable objectid,"Debugger","CheckableIC","1"
  82.       call RexxInstSelect      objectid,"Debugger"
  83.       call RexxInstSelect      objectid,"DebuggerConfig"
  84.    end
  85.    else do
  86.       call RexxInstSetVariable objectid,"Toolkit" ,"CheckableTK","0"
  87.       call RexxInstDeselect    objectid,"Toolkit"
  88.       call RexxInstDeselect    objectid,"ToolkitConfig"
  89.  
  90.       call RexxInstSetVariable objectid,"Samples" ,"CheckableSM","0"
  91.       call RexxInstDeselect    objectid,"Samples"
  92.       call RexxInstDeselect    objectid,"SamplesConfig"
  93.  
  94.       call RexxInstSetVariable objectid,"Debugger","CheckableIC","0"
  95.       call RexxInstDeselect    objectid,"Debugger"
  96.       call RexxInstDeselect    objectid,"DebuggerConfig"
  97.    end
  98. end
  99. else do
  100.    call RexxInstSetVariable objectid,"Toolkit" ,"CheckableTK","0"
  101.    call RexxInstDeselect    objectid,"Toolkit"
  102.    call RexxInstDeselect    objectid,"ToolkitConfig"
  103.  
  104.    call RexxInstSetVariable objectid,"Samples" ,"CheckableSM","0"
  105.    call RexxInstDeselect    objectid,"Samples"
  106.    call RexxInstDeselect    objectid,"SamplesConfig"
  107.  
  108.    call RexxInstSetVariable objectid,"Debugger","CheckableIC","0"
  109.    call RexxInstDeselect    objectid,"Debugger"
  110.    call RexxInstDeselect    objectid,"DebuggerConfig"
  111. end
  112.  
  113. /* Determine if we will check the toolkit documentation checkbox and feature
  114. */
  115. /* Check for a syslevel file and the correct version
  116. */
  117. if ReadSysLevel(package"\syslevel.jtk")  then do
  118.    if st.bSysVersion = 11 & st.bSysModify = 6 then do
  119.       call RexxInstSetVariable objectid,"TlktDoc" ,"CheckableTD","1"
  120.       call RexxInstSelect      objectid,"TlktDoc"
  121.       call RexxInstSelect      objectid,"TlktDocConfig"
  122.    end
  123.    else do
  124.       call RexxInstSetVariable objectid,"TlktDoc" ,"CheckableTD","0"
  125.       call RexxInstDeselect    objectid,"TlktDoc"
  126.       call RexxInstDeselect    objectid,"TlktDocConfig"
  127.    end
  128. end
  129. else do
  130.    call RexxInstSetVariable objectid,"TlktDoc" ,"CheckableTD","0"
  131.    call RexxInstDeselect    objectid,"TlktDoc"
  132.    call RexxInstDeselect    objectid,"TlktDocConfig"
  133. end
  134.  
  135. /* Determine if we will check the Unicode Font checkbox and feature
  136. */
  137. /* Check for a syslevel file and the correct version
  138. */
  139. if ReadSysLevel(package"\syslevel.juf")  then do
  140.    if (st.bSysVersion = 10) & (st.bSysModify = 0) then do
  141.       call RexxInstSetVariable objectid,"UniFont" ,"CheckableUF","1"
  142.       call RexxInstSelect      objectid,"UniFont"
  143.       call RexxInstSelect      objectid,"UniFontConfig"
  144.       call RexxInstSelect      objectid,"TTEngine"
  145.       call RexxInstSelect      objectid,"TTEngineConfig"
  146.    end
  147.    else do
  148.       call RexxInstSetVariable objectid,"UniFont" ,"CheckableUF","0"
  149.       call RexxInstDeselect    objectid,"UniFont"
  150.       call RexxInstDeselect    objectid,"UniFontConfig"
  151.       call RexxInstSelect      objectid,"TTEngine"
  152.       call RexxInstDeselect    objectid,"TTEngineConfig"
  153.    end
  154. end
  155. else do
  156.    call RexxInstSetVariable objectid,"UniFont" ,"CheckableUF","0"
  157.    call RexxInstDeselect    objectid,"UniFont"
  158.    call RexxInstDeselect    objectid,"UniFontConfig"
  159.    call RexxInstSelect      objectid,"TTEngine"
  160.    call RexxInstDeselect    objectid,"TTEngineConfig"
  161. end
  162.  
  163. return 0
  164.  
  165. /* Subroutine: ReadSysLevel
  166. *     Input: fs - filespec of a syslevel file
  167. *    Output: 0 = File not readable
  168. *            1 = File readable
  169. *
  170. * Side Effects: Structures st and slfh created:
  171. *               st = Syslevel Table      ( see comments below )
  172. *             slfh = Sysleve File Header ( see comments below )
  173. *
  174. *
  175. *
  176. *
  177. */
  178.  
  179.  
  180. ReadSysLevel: procedure expose slfh. st.
  181. call Trace OFF
  182. parse arg fs
  183.  
  184.    res = 0
  185.    if stream(fs,"C","Query Exists") <> "" then do
  186.       data = charin(fs,1,chars(fs))
  187.       slfh.usSignature   = c2x(reverse(substr(data,1,2)))     /* special # for id of syslevel file */
  188.       slfh.achSignature  = substr(data,3,8)                   /* string to id slf file, must be 'SYSLEVEL' */
  189.       slfh.achJulian     = substr(data,11,5)                  /* date of version */
  190.       slfh.usSlfVersion  = c2x(reverse(substr(data,16,2)))    /* version of syslevel file, must be 1 */
  191.       slfh.ausReserved   = c2x(substr(data,18,16))            /* reserved */
  192.       slfh.ulTableOffset = c2d(reverse(substr(data,34,4)))    /* offset of SYSTABLE */
  193.  
  194.       /* Calculate table start
  195.       */
  196.       tblst = slfh.ulTableOffset+1
  197.  
  198.       st.usSysId       = c2x(reverse(substr(data, tblst+0,2))) /* identifies system /subsytem */
  199.       st.bSysEdition   = c2x(substr(data, tblst+2,1))          /* edition of system, eg SE=00, EE=01 */
  200.       st.bSysVersion   = c2x(substr(data, tblst+3,1))          /* version, eg 1.00=10, 1.10=11 */
  201.       st.bSysModify    = c2x(substr(data, tblst+4,1))          /* modify, eg 1.00=00, 1.01=01 */
  202.       st.usSysDate     = c2x(reverse(substr(data, tblst+5,2))) /* date of system */
  203.       st.achCsdLevel   = substr(data, tblst+7,8)               /* subsytem CSD level, eg, XR?0000_ */
  204.       st.achCsdPrev    = substr(data, tblst+15,8)              /* as above, except for prev system */
  205.       st.achSysName    = substr(data, tblst+23,80)             /* Title of system / subsytem (ASCIIZ) */
  206.       st.achCompId     = substr(data, tblst+103,9)             /* component ID of subsytem */
  207.       st.bRefreshLevel = c2x(substr(data, tblst+112,1))
  208.       st.achType       = substr(data, tblst+113,9)             /* Null terminated type (8 chars +'\0') */
  209.       st.usReserved    = substr(data, tblst+122,12)            /* reserved, must be 0 */
  210.       res = 1
  211.       call stream fs,"C","Close"
  212.    end
  213. return res
  214.