home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 17 Fixes30 / 17-Fixes30.zip / xr_w039.kdk / FIXSYSL.CMD < prev    next >
OS/2 REXX Batch file  |  1997-06-11  |  4KB  |  109 lines

  1. /**************************************/
  2. /* Correct syslevel errors for Warp:  */
  3. /* S3 video  Current CSD XR02110      */
  4. /*          Previous CSD XR03xxx      */
  5. /* Set Current=Prev                   */
  6. /* APTIVA    Current CSD XR03005      */
  7. /*                   COMPID 562260100 */
  8. /*                   TYPE WP          */
  9. /* Set       Current CSD=XR03002      */
  10. /*                                    */
  11. /* 6/11/97 - use different method to  */
  12. /*           find boot drive          */
  13. /**************************************/
  14. Arg file .                                                /* File to process */
  15. If file='' then
  16.   Do
  17.     Say 'You must specify the fully qualified path of the SYSLEVEL file you'
  18.     Say 'want corrected.'
  19.     Say
  20.     Say 'Example:   fixsysl c:\os2\install\syslevel.os2'
  21.     Signal Done
  22.   End
  23.  
  24. /*******************/
  25. /* Find boot drive */
  26. /*******************/
  27. env='OS2ENVIRONMENT'                                    /* Environment name */
  28. Parse Upper Value Value('PATH',,env) With '\OS2\SYSTEM' -2 boot +2
  29. If boot='' | length(boot)<>2 | right(boot,1)<>':' then
  30.   Do
  31.     Say 'Unable to locate your boot drive based on the location of \OS2\SYSTEM'
  32.     Say 'in your PATH statement in CONFIG.SYS.'
  33.     Signal Done
  34.   End
  35.  
  36. /***********************************/
  37. /* Register all REXXUTIL functions */
  38. /***********************************/
  39. rc=RxFuncAdd('SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs')
  40. Call SysLoadFuncs
  41.  
  42. path=FileSpec('DRIVE',file)||FileSpec('PATH',file)
  43. Parse value FileSpec('NAME',file) with .'.'ext .
  44. tempfile=SysTempFileName(path||'SYSLEV??.'||ext)
  45. Call SysFileTree file,'files','B'
  46. Parse value files.1 with . . . atts .
  47.  
  48. ro=pos('R',atts)>0    /* 1=R/O attribute set */
  49. If ro then
  50.   Do
  51.     chk=boot||'\OS2\ATTRIB.EXE'
  52.     If stream(chk,'C','Query Exists')='' then
  53.       Do
  54.         Say 'ATTRIB command not available, cannot reset R/O attribute of' file
  55.         Signal Done
  56.       End
  57.   End
  58.  
  59. size=stream(file,'C','Query Size')
  60. call stream file,'C','Open Read'
  61. data=charin(file,1,size)
  62. call stream file,'C','Close'
  63.  
  64. curcsd =substr(data,45,7)                               /* Current CSD level */
  65. prevcsd=substr(data,53,7)                              /* Previous CSD level */
  66. compid=substr(data,141,9)                                    /* Component ID */
  67. type=strip(substr(data,151,8),'B','00'x)                             /* Type */
  68.  
  69. update=0
  70. /*****************************************/
  71. /* S3 driver install messed up SYSLEVEL? */
  72. /*****************************************/
  73. If curcsd='XR02110' & substr(prevcsd,1,4)='XR03' then
  74.   Do
  75.     Say 'Changing Current CSD level from 'curcsd' to 'prevcsd
  76.     data=overlay(prevcsd,data,45)
  77.     update=1
  78.   End
  79. Else
  80.   /****************************/
  81.   /* APTIVA Preload incorrect */
  82.   /****************************/
  83.   If curcsd='XR03005' & compid='562260100' & type='WP' then
  84.     Do
  85.       Say 'Changing Current CSD level from 'curcsd' to XR03002'
  86.       data=overlay('XR03002',data,45)
  87.       update=1
  88.     End
  89. If update then
  90.   Do
  91.     '@COPY' file tempfile '>NUL'                     /* Backup existing file */
  92.     Say 'Saved 'file' as 'tempfile
  93.     If ro then                                   /* Reset R/O attrib if need */
  94.       '@ATTRIB -R 'file '>NUL'
  95.     Call SysFileDelete(file)                              /* Delete existing */
  96.     Say 'Deleted 'file
  97.     call stream file,'C','Open Write'
  98.     Call charout file,data                                     /* Create new */
  99.     call stream file,'C','Close'
  100.     If ro then                           /* Set R/O attrib if previously set */
  101.       '@ATTRIB +R 'file '>NUL'
  102.     Say 'Created 'file
  103.   End
  104. Else
  105.   Say file 'is not corrupted.'
  106.  
  107. Done:
  108. Exit
  109.