home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / b120.zip / toggle.cmd < prev   
OS/2 REXX Batch file  |  2000-01-09  |  4KB  |  130 lines

  1. /*
  2.  
  3. toggle.cmd verison 1.0
  4. ----------------------
  5.  
  6.  
  7. What version of OS/2 is this for?
  8. ---------------------------------
  9. This script will run on ANY OS/2 system. However, it is intended for Warp 3.0.
  10.  
  11.  
  12. What it does:
  13. -------------
  14. This rexx script patches the OS/2 system files syslevel.os2 and syslevel.mpm to
  15. allow the installation of applications that require a Warp 4.0 base operating
  16. system. The most noteable of which is IBM's TCPIP 4.1. There are others and
  17. hopefulyl this will aid those that wish to install those packages to existing
  18. Warp 3.0 machines.
  19.  
  20. The ONLY two files that this script touches are \OS2\INSTALL\SYSLEVEL.OS2 and
  21. \MMOS2\INSTALL\SYSLEVEL.MPM.
  22.  
  23.  
  24. How it does it:
  25. ---------------
  26. By patching these two files, most installers will be fooled into thinking that
  27. they are installing to a computer with a Warp 4.0 base operating system. What is
  28. patched is a SINGLE byte at offset location 28h. On a Warp 3.0 machine that
  29. byte is 30h and on a Warp 4.0 machine it's 40h...
  30.  
  31.  
  32. Should I use this rexx script?
  33. ------------------------------
  34. Use TOTALLY on your on decision. I don't support this is ANY WAY, SHAPE or
  35. MANNER than a very big, smiley... GOOD LUCK, BUB!
  36.  
  37.  
  38. How often do I need to run this thing...
  39. ----------------------------------------
  40. You can run this as often as you like! First time you run it on a Warp 3.0 box,
  41. the syslevel files are patched to appear as Warp 4.0. The next time you run it,
  42. it gets toggled BACK to appear as a Warp 3.0 machine again. Flippy-flop...
  43.  
  44.  
  45. How do I do it?
  46. ---------------
  47. Run this script from the command line, with the argument "COOL", on your OS/2
  48. BOOT hard drive. If no errors pop up, then it worked!
  49.  
  50. The actual command looks like: toggle cool
  51.  
  52. */
  53.  
  54.   '@echo off'
  55.  
  56.   parse arg stuff .
  57.  
  58.   stuff=translate(stuff)
  59.  
  60.   if stuff \= 'COOL' then do
  61.     say'Before you can actually run his script, you MUST read the comments inside'
  62.     say'of it.'
  63.     exit 1
  64.     end /* if */
  65.  
  66.   os2dir='\os2\install\'
  67.   mpmdir='\mmos2\install\'
  68.  
  69. /* fix os2 */
  70.  
  71.   filename='syslevel.os2'
  72.  
  73.   if stream(os2dir||filename,'c','query exists')='' then do
  74.     say''
  75.     say'Can not find '||filename||', patch not applied!'
  76.     say''
  77.     exit 1
  78.     end /* if */
  79.  
  80.   say'Found '||filename
  81.  
  82. /* make the file accessable */
  83.  
  84.   'attrib -r '||os2dir||filename||' 1>nul'
  85.   say'Removed read restriction from '||filename
  86.  
  87. /* use charout instead of lineout... we don't want CRLF's in these files! */
  88.  
  89.   oldByte=c2x(charin(os2dir||filename,41,1))
  90.  
  91.   if oldByte=30 then newByte=x2c(40)
  92.                 else newByte=x2c(30)
  93.  
  94.   call charout os2dir||filename, newByte, 41
  95.   call stream  os2dir||filename,'c','close'
  96.   say'Applied patch to '||filename
  97.   say'Changed system from Warp'oldByte' to Warp'c2x(newByte)' signature.'
  98.  
  99. /* fix mpm */
  100.  
  101.   filename='syslevel.mpm'
  102.  
  103.   if stream(mpmdir||filename,'c','query exists') ='' then do
  104.     say''
  105.     say'Can not find '||filename||', patch not applied!'
  106.     say''
  107.     exit 1
  108.     end /* if */
  109.  
  110.   say''
  111.   say'Found '||filename
  112.  
  113. /* make the file accessable */
  114.  
  115.   'attrib -r '||mpmdir||filename||' 1>nul'
  116.   say'Removed read restriction from '||filename
  117.  
  118. /* use charout instead of lineout... we don't want CRLF's in these files! */
  119.  
  120.   oldByte=c2x(charin(mpmdir||filename,41,1))
  121.  
  122.   if oldByte=30 then newByte=x2c(40)
  123.                 else newByte=x2c(30)
  124.  
  125.   call charout mpmdir||filename, newByte, 41
  126.   call stream  mpmdir||filename,'c','close'
  127.   say'Applied patch to '||filename
  128.   say'Changed system from Warp'oldByte' to Warp'c2x(newByte)' signature.'
  129.  
  130.