home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 17 Fixes30
/
17-Fixes30.zip
/
xr_w029.zip
/
XR_W029Q.DSK
/
SYSZMPM.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1997-03-13
|
10KB
|
222 lines
/*****************************************************************************/
/* (C) Copyright IBM Corp 1996; All rights reserved. */
/*****************************************************************************/
/* REXX cmd file to restore SYSLEVEL.MPM to correct vlalues for various */
/* versions of OS/2 Warp. */
/* */
/* Do the following: */
/* 1. Verify SYSLEVEL.OS2 and SYSLEVEL.MPM both exist. */
/* 2. Locate MMPM via SET MMBASE= entry in CONFIG.SYS. If not found exit, */
/* nothing to do. */
/* 3. Get CSD level and COMPID from SYSLEVEL.OS2 in OS2\INSTALL directory of */
/* boot drive. */
/* 4. Get CSD level and COMPID from SYSLEVEL.MPM in MMOS2\INSTALL directory. */
/* 5. If either value does not match, backup existing SYSLEVEL.MPM as */
/* SYSLGA.MPM (if it exists then DO NOT backup). */
/* 6. Update CSD level and/or COMPID of SYSLEVEL.MPM with data from */
/* SYSLEVEL.OS2 file. */
/* 7. Write out new SYSLEVEL.MPM file. */
/* */
/* For XR?3000, COMPID of 562137400 is correct for MMPM even though different*/
/* from SYSLEVEL.OS2 value. Was a separate product at that time. */
/* */
/* Preserve the R/O attribute if it is on for the current file. */
/* */
/* DEFECT 162197 - For Denmark Warp Server, make version of SYSLEVEL.MPM */
/* same as SYSLEVEL.OS2 to prevent Fixtool from changing */
/* SYSLEVEL.MPM CSD level to fixpak name. */
/* */
/* DEFECT 172532 - For German fullpack and fullpack connect, change version */
/* from 3001 to 3000. */
/* (same as SYSLEVEL.OS2). */
/* */
/* Remove restriction on running on a US system so will correct bad Current */
/* CSD level of SYSLEVEL.MPM for Warp Server SMP (US). */
/*****************************************************************************/
'@Echo off'
'CLS'
/*****************************************************************************/
/* Register all REXXUTIL functions */
/*****************************************************************************/
rc=RxFuncAdd('SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs')
If rc>1 then
Do
Say 'Unable to register REXXUTIL functions, cannot continue.'
Signal Done
End
Call SysLoadFuncs
/*************************************************/
/* Use environment variables to locate following */
/*************************************************/
env='OS2ENVIRONMENT' /* Environment name */
boot=Filespec('DRIVE',value('COMSPEC',,env)) /* Find Boot drive */
If boot='' | length(boot)<>2 | right(boot,1)<>':' then
Do
Say 'Unable to locate your boot drive via the COMSPEC environment'
Say 'variable. Cannot continue.'
Signal Done
End
Say 'Boot drive is 'boot
/******************/
/* Locate MMBASE. */
/******************/
mmos2=value('MMBASE',,env) /* Find MMBASE setting */
If mmos2='' then
Do
Say 'Multimedia is not installed on this system, nothing to do.'
Signal Done
End
If right(mmos2,1)=';' then
mmos2=left(mmos2,length(mmos2)-1)
Say 'Multimedia is installed in 'mmos2
/*************************************************/
/* Make sure SYSLEVEL files exist and are valid. */
/*************************************************/
os2file=boot||'\OS2\INSTALL\SYSLEVEL.OS2'
mpmfile=mmos2||'\INSTALL\SYSLEVEL.MPM'
Parse value 0 0 with os2found mpmfound .
If stream(os2file,'c','Query Exists')='' then
Say os2file' not found, required.'
Else
os2found=1
If stream(mpmfile,'c','Query Exists')='' then
Say mpmfile' not found, required.'
Else
mpmfound=1
If os2found+mpmfound<>2 then
Signal Done
/****************************************/
/* Read SYSLEVEL.OS2 into rexx variable */
/****************************************/
Say 'Checking 'os2file
sig='FFFF'x||'SYSLEVEL' /* SYSLEVEL signature */
size=stream(os2file,'C','Query Size')
Call stream os2file,'C','Open Read'
os2line=charin(os2file,1,size)
Call stream os2file,'C','Close'
If left(os2line,10)<>sig then
Do
Say os2file' is not a valid SYSLEVEL file.'
Say 'Does not start with "FFFFSYSLEVEL" (FFFF is HEX).'
Signal Done
End
os2ver=substr(os2line,41,2) /* Version in hex */
os2csd=substr(os2line,45,8) /* Current CSD level */
os2cid=substr(os2line,141,9) /* COMPID */
Say ' Current CSD level: 'os2csd' COMPID: 'os2cid' Version: 'c2x(os2ver)
/****************************************/
/* Read SYSLEVEL.MPM into rexx variable */
/****************************************/
Say 'Checking 'mpmfile
mpmsave=mmos2||'\INSTALL\SYSLGA.MPM'
size=stream(mpmfile,'C','Query Size')
Call stream mpmfile,'C','Open Read'
mpmline=charin(mpmfile,1,size)
Call stream mpmfile,'C','Close'
If left(mpmline,10)<>sig then
Do
Say mpmfile' is not a valid SYSLEVEL file.'
Say 'Does not start with "FFFFSYSLEVEL" (FFFF is HEX).'
Signal Done
End
mpmver=substr(mpmline,41,2) /* Version in hex */
mpmcsd=substr(mpmline,45,8) /* Current CSD level */
mpmcid=substr(mpmline,141,9) /* COMPID */
Say ' Current CSD level: 'mpmcsd' COMPID: 'mpmcid' Version: 'c2x(mpmver)
/************************************************************/
/* Check CSD level and COMPID against OS2. Replace if diff. */
/* For XR?3000, COMPID of 562137400 is correct even though */
/* different from SYSLEVEL.OS2 value. */
/************************************************************/
update=0 /* No update done yet */
cid3000='562137400' /* MMPM COMPID for Warp GA */
If os2csd=mpmcsd&(os2cid=mpmcid | (substr(os2csd,4,4)='3000'&mpmcid=cid3000)) then
Do
Say 'CSD level and COMPID of SYSLEVEL.MPM are correct.'
Signal ChkDK
End
If os2csd<>mpmcsd then
mpmline=overlay(os2csd,mpmline,45,8)
If os2cid<>mpmcid then
If substr(os2csd,4,4)='3000' then /* Warp GA? */
mpmline=overlay(cid3000,mpmline,141,9)
Else /* No */
mpmline=overlay(os2cid,mpmline,141,9)
update=1 /* Remember we made a change */
/*****************************************************/
/* If Denmark OS/2 version=3.01 and MPM version=3.00 */
/* make MPM version=OS/2 version. */
/*****************************************************/
ChkDK:
If substr(os2csd,3,1)='D' then /* Danish system? */
Do
If c2x(os2ver)='3001' & c2x(mpmver)='3000' then
Do
mpmline=overlay(os2ver,mpmline,41)
update=1 /* Remember we made a change */
End
Else
Say 'Version is correct.'
End
/*****************************************************/
/* German Fullpack or Fullpack Connect. */
/*****************************************************/
/* If German OS/2 version=3.00 and MPM version=3.01 */
/* make MPM version=OS/2 version. */
/*****************************************************/
If substr(os2csd,1,7)='XRG3001'|substr(os2csd,1,7)='XRG3003' then /* German Warp Connect? */
Do
If c2x(os2ver)='3000' & c2x(mpmver)='3001' then
Do
mpmline=overlay(os2ver,mpmline,41)
update=1 /* Remember we made a change */
End
Else
Say 'Version is correct.'
End
If \update then
Signal Done
/****************************************************/
/* If we get here then we changed some value in the */
/* SYSLEVEL.MPM data so need to backup the file and */
/* create a new one with the updated data. Don't */
/* overlay existing backup if it exists. */
/****************************************************/
mpmver=substr(mpmline,41,2)
mpmcsd=substr(mpmline,45,8)
mpmcid=substr(mpmline,141,9)
Say ' New CSD level: 'mpmcsd' COMPID: 'mpmcid' Version: 'c2x(mpmver)
If Stream(mpmsave,'C','Query Exists')='' then /* Backup file already exist? */
'@COPY 'mpmfile mpmsave' > NUL' /* No, back it up then */
Call SysFileTree mpmfile,'SFILE','F' /* Get file specs */
Parse value sfile.1 with . . . atts . /* Just attributes */
mpmro=pos('R',atts)>0 then /* Get Read Only bit */
If mpmro then /* Was it set? */
'@ATTRIB -R' mpmfile /* Yes, turn of so can delete */
'@DEL 'mpmfile' >NUL'
Call Stream mpmfile,'C','Open Write'
Call charout mpmfile,mpmline /* Write updated file */
Call Stream mpmfile,'C','Close'
If mpmro then /* Turn on R/O bit if on before */
'ATTRIB +R' mpmfile
Say mpmfile' update complete.'
Say 'Original 'mpmfile' saved as 'mpmsave'.'
/*******************************/
/* Only exit from this program */
/*******************************/
Done:
Exit