home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1993 #2
/
Image.iso
/
lan
/
21ripl.zip
/
IBMLS.ZIP
/
RPLUCFIT.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1993-05-28
|
21KB
|
476 lines
/*******************************************************************/
/* REXX procedure to update the client.FIT by making the following */
/* changes to the original FIT: */
/* - removes DISPLAY.DLL entries, if present. */
/* - If OS/2 2.1, and FIT is not at 2.1 level, it is updated to */
/* to 2.1 level by removing VGA FON entries and some APPS */
/* entries, and new 2.1 entries are added. */
/* - If not OS/2 2.1, enables/disables appropriate .FON entries. */
/* - If requested, changes the target OS2 root directory. */
/* - If requested, changes the bus type entries. */
/* */
/* Return codes: */
/* 0 - No error */
/* 2 - FIT did not need to be updated (not an error) */
/* 4 - FIT could not be updated (error) */
/* */
/* Copyright: (C) Copyright IBM Corp. 1993 */
/* */
/*******************************************************************/
parse arg client, rpldir, driver, Bustype, currentOS2, newOS2, changeOS2, ,
clientbootdrv, version21
blkspace = ' '
/* build fully qualified path names for client.fit */
fitname = rpldir'\FITS\'client'.FIT'
tmpfitname = rpldir'\FITS\'client'.TMP'
bakfitname = rpldir'\FITS\'client'.BAK'
/* make sure temp files do not exist */
Call Delete_File tmpfitname
Call Delete_File bakfitname
/* build a new FIT */
os2verflag = 0
newos2iniflag = 0
psfontsflag = 0
isofontsflag = 0
pre21fitflag = 1
addnewwinos2flag = 0
xgadmqsflag = 0
do until lines(fitname) = 0
data = translate(linein(fitname))
If data <> '' Then Do
/* not a null line, check line */
removeentry = 0
If substr(data, 1, 2) = '\\' Then Do
/* UNC record, get server name */
datap = pos('\', data, 3)
If datap <> 0 Then Do
servername = substr(data, 3, datap-3)
end
end
If version21 = 1 Then Do
/* if pre-2.1 fit, must check for enties to be removed/updated */
/* the pre21fit flag will be reset when we have encountered */
/* an entry that is 2.1 unique and we know we can skip all this */
/* for subsequence records */
If pre21fitflag = 1 Then Do
/* may be pre-OS/2 2.1 FIT, continue testing for entries */
/* to be removed/updated */
datap = pos('; VGA DISPLAY', data)
if datap <> 0 Then Do
/* indicate entry is to be removed */
removeentry = 1
end
else Do
/* look for XGA/8514 comment */
datap = pos('; XGA & 8514/A', data)
if datap <> 0 Then Do
/* update entry */
newdata = '; VGA,' || substr(data, 2)
data = newdata
end
else Do
/* look for APPS\* entries to be removed */
apps = '\APPS\'
datap = pos(apps || 'PMSTICKY.$', data)
If datap <> 0 Then Do
/* indicate entry is to be removed */
removeentry = 1
end
else Do
datap = pos(apps || '*.$', data)
If datap <> 0 Then Do
/* check for *.$$$, keep it, remove all others */
datap = pos(APPS || '*.$$$', data)
If datap = 0 Then Do
/* indicate entry is to be removed */
removeentry = 1
end
end
end
end
end
end
end
/* remove DISPLAY.DLL references in all cases */
datap = pos(':\OS2\DLL\DISPLAY.DLL', data)
if datap <> 0 Then Do
/* indicate entry is to be removed */
removeentry = 1
end
If removeentry = 0 Then Do
/* entry still valid, continue testing */
If driver <> '' Then Do
/* check for .FON entry and if not OS/2 2.1, enable/disable */
/* the entry depending on the driver type */
helvp = 0
courp = 0
timesp = 0
helvp = pos(':\OS2\DLL\HELV.FON', data)
If helvp = 0 Then Do
courp = pos(':\OS2\DLL\COURIER.FON',data)
If courp = 0 Then Do
timesp = pos(':\OS2\DLL\TIMES.FON',data)
end
end
If helvp <> 0 | courp <> 0 | timesp <> 0 Then Do
datal = length(data)
dpos = pos('.VGA', data)
If dpos <> 0 Then Do
If version21 = 0 Then Do
/* VGA font references will still be present */
/* check for enable/disable */
If driver = 'IBMVGA32' Then Do
If substr(data, 1, 1) = ';' Then Do
/* enable VGA .FON entry */
data = substr(data, 2)
end
end
else Do
/* make sure entry is disabled */
If substr(data, 1,1) <> ';' Then Do
/* disable non-VGA .FON entry */
newdata = ';'data
data = newdata
end
end
end
else Do
/* OS/2 2.1, remove VGA references */
removeentry = 1
end
end
else Do
/* look for *.BGA references */
dpos = pos('.BGA', data)
If dpos <> 0 Then Do
/* BGA reference */
/* check to see if entry needs to be enabled/disabled */
If (version21 = 1 & driver = 'IBMVGA32') Then Do
/* make sure entry is enabled */
If substr(data, 1, 1) = ';' Then Do
/* enable VGA, XGA, 8514 .FON entry */
data = substr(data, 2)
end
end
else Do
If driver = 'IBMXGA32' | driver = 'IBM8514' | ,
driver = '8514_32' Then Do
If substr(data, 1, 1) = ';' Then Do
/* enable XGA/8514 .FON entry */
data = substr(data, 2)
end
end
else If substr(data, 1, 1) <> ';' Then Do
/* disable non-XGA/8514 .FON entry */
newdata = ';'data
data = newdata
end
end
end
end
end
end
If removeentry = 0 Then Do
/* entry still valid, continue testing */
/* check for possible operating system change */
if changeOS2 = 1 Then Do
If substr(data, 1, 2) = '; ' Then srvfname = word(data, 3)
else srvfname = word(data, 2)
os2p = pos(currentOS2'\', srvfname)
if os2p <> 0 Then Do
/* old OS2 entry found, update it */
os2p = pos(currentOS2, data, length(word(data,1))+1)
newdata = substr(data, 1, os2p-1)
newdata = newdata || newOS2
newdata = newdata || substr(data, os2p+length(currentOS2))
data = newdata
end
end
/* check for Bustype change */
If Bustype <> ' ' Then Do
/* check for VDMA.SYS entry */
datap = pos(':\OS2\MDOS\VDMA.SYS', data)
If datap <> 0 Then Do
/* this is one of the VDMA.SYS entries */
datap2 = pos('OS2\MDOS\VDMAPS2.SYS', data)
If datap2 <> 0 Then Do
/* MCA entry */
If Bustype = 'MCA' Then Do
If substr(data, 1, 1) = ';' Then Do
/* entry disabled, enable it */
newdata = substr(data, datap-1)
data = newdata
end
end
else Do
/* make sure entry is disabled */
If substr(data, 1, 1) <> ';' Then Do
newdata = '; ' || data
data = newdata
end
end
end
else Do
/* check for AT entry */
datap2 = pos('OS2\MDOS\VDMAAT.SYS', data)
If datap2 <> 0 Then Do
/* ISA/EISA entry */
If Bustype = 'ISA' | Bustype = 'EISA' Then Do
If substr(data, 1, 1) = ';' Then Do
/* entry disabled, enable it */
newdata = substr(data, datap-1)
data = newdata
end
end
else Do
/* entry enabled, disable it */
If substr(data, 1, 1) <> ';' Then Do
newdata = '; ' || data
data = newdata
end
end
end
end
end
end
end
ucdata = translate(data)
If newos2iniflag = 0 Then Do
/* watch for new 2.1 INI references */
os2p = pos('\OS2.!!!', ucdata)
If os2p <> 0 Then Do
/* if OS2.!!! is found, this is a 2.1 FIT and we can */
/* reset the pre21fitflag to bypass some checking at the top */
/* of the loop */
pre21fitflag = 0
newos2iniflag = 1
/* check for possible early exit */
If Bustype = '' & changeOS2 = 0 Then Do
/* don't really need to update FIT for this case */
/* quit at this point */
Call Lineout tmpfitname /* close file */
Call Lineout fitname /* close file */
Call Delete_File tmpfitname
return 2 /* update not needed */
end
end
end
If newos2appsiniflag = 0 Then Do
/* watch for new 2.1 APPS references */
os2p = pos('\APPS\*.INI', ucdata)
If os2p <> 0 Then newos2appsiniflag = 1
end
If psfontsflag = 0 Then Do
/* watch for PSFONTS reference */
os2p = pos('\PSFONTS', ucdata)
If os2p <> 0 Then psfontsflag = 1
end
If os2verflag = 0 Then Do
/* watch for OS2VER reference, set flag if found */
os2p = pos(':\OS2VER ', ucdata)
If os2p <> 0 Then os2verflag = 1
end
If isofontsflag = 0 Then Do
/* watch for ISO font reference */
os2p = pos('\HELVI.FON', ucdata)
If os2p <> 0 Then isofontsflag = 1
else Do
/* watch for EGA font comment line, if we see it then */
/* the new ISO font entries need to be added */
datap = pos('; EGA DISPLAY ', data)
if datap <> 0 Then Do
/* add ISO entries */
trg = newOS2'\OS2\DLL\'
src = clientbootdrv':\OS2\DLL\'
newdata = '; XGA-2 ISO font support'
Call Lineout tmpfitname, newdata
newdata = src || 'HELVI.FON' || ' ' || trg || 'HELVI.XGA'
Call Lineout tmpfitname, newdata
newdata = src || 'COURIERI.FON' || ' ' || trg || 'COURIERI.XGA'
Call Lineout tmpfitname, newdata
newdata = src || 'TIMESI.FON' || ' ' || trg || 'TIMESI.XGA'
Call Lineout tmpfitname, newdata
isofontsflag = 1
Call Lineout tmpfitname, ''
end
end
end
If xgadmqsflag = 0 Then Do
/* watch for XGA$DMQS reference */
os2p = pos(':\XGA$DMQS', ucdata)
If os2p <> 0 Then xgadmqsflag = 1
else Do
/* XGA$DMQS entry will be before Remote Install comment if */
/* it is present */
os2p = pos('; OS/2 REMOTE INSTALL', ucdata)
If os2p <> 0 Then Do
/* add XGA$DMQS entry */
trg = newOS2'\XGA$DMQS'
src = clientbootdrv':\XGA$DMQS'
newdata = src || blkspace || trg
Call Lineout tmpfitname, newdata
xgadmqsflag = 1
Call Lineout tmpfitname, ''
end
end
end
/* if OS/2 2.1, check to see if new references need to be added */
If version21 = 1 Then Do
os2p = pos('\OS2.DTP', ucdata)
If os2p <> 0 Then Do
/* OS2.DTP found, must be pre-2.1 FIT, indicate */
/* OS2.DTP record is to be removed, add new INI references */
removeentry = 1
If newos2iniflag <> 1 Then Do
/* need to add new INI references */
trg = '\\'servername'\WRKFILES\'client'\OS2\'
src = clientbootdrv':\OS2\'
newdata = src'OS2.!!!' || ' ' || blkspace || trg || 'OS2INI.!!!'
Call Lineout tmpfitname, newdata
newdata = src'OS2SYS.!!!' || blkspace || trg || 'OS2SYINI.!!!'
Call Lineout tmpfitname, newdata
newdata = src'OS2.###' || ' ' || blkspace || trg || 'OS2INI.###'
Call Lineout tmpfitname, newdata
newdata = src'OS2SYS.###' || blkspace || trg || 'OS2SYINI.###'
Call Lineout tmpfitname, newdata
newos2iniflag = 1
end
end
else Do
/* look for \APPS\*.TMP entry */
os2p = pos('\APPS\*.TMP', ucdata)
If os2p <> 0 Then Do
/* check to see if new APPS entries have already been */
/* encountered. If not, insert new references prior to */
/* *.TMP */
If newos2appsiniflag <> 1 Then Do
/* need to add new APPS references */
trg = '\\'servername'\WRKFILES\'client'\OS2'
src = clientbootdrv':\OS2\APPS\'
newdata = src'*.INI' || blkspace || trg
Call Lineout tmpfitname, newdata
newdata = src'*.!!!' || blkspace || trg
Call Lineout tmpfitname, newdata
newdata = src'*.###' || blkspace || trg
Call Lineout tmpfitname, newdata
newos2appsiniflag = 1
end
end
else Do
/* watch for OS2KRNL reference */
os2p = pos('\OS2KRNL', ucdata)
If os2p <> 0 Then Do
/* if PSFONTS have not been encountered, add it prior to */
/* OS2KRNL reference */
If psfontsflag = 0 Then Do
/* add PSFONTS reference */
newdata = clientbootdrv':\PSFONTS' || blkspace || newOS2'\PSFONTS'
Call Lineout tmpfitname, newdata
psfontsflag = 1
end
end
else Do
/* watch for APPS\*.$$$ reference */
os2p = pos('\APPS\*.$$$', ucdata)
If os2p <> 0 Then Do
/* replace with new type reference */
newdata = substr(data, 1, os2p+8) || '??' ||,
substr(data, os2p+11)
data = newdata
end
else Do
/* watch for WINOS2\*.GRP reference */
os2p = pos('\WINOS2\*.GRP', ucdata)
If os2p <> 0 Then Do
/* set flag to cause new WINOS2 entries to be */
/* added AFTER *.GRP */
addnewwinos2flag = 1
end
end
end
end
end
end
end
end
If removeentry = 0 Then Do
/* write data record to new FIT */
Call Lineout tmpfitname, data
If addnewwinos2flag = 1 Then Do
/* add new WINOS2 entries. They must be after *.GRP */
trg = '\\'servername'\WRKFILES\'client'\OS2\MDOS\WINOS2'
src = clientbootdrv':\OS2\MDOS\WINOS2\'
newdata = src'*.TMP' || ' ' || trg
Call Lineout tmpfitname, newdata
newdata = src'*.CAL' || ' ' || trg
Call Lineout tmpfitname, newdata
newdata = src'*.CRD' || ' ' || trg
Call Lineout tmpfitname, newdata
newdata = src'*.WRI' || ' ' || trg
Call Lineout tmpfitname, newdata
addnewwinos2flag = 0
end
end
end
/* does os2ver statment need to be added? */
If version21 = 1 & os2verflag = 0 Then Do
/* add os2ver statement to end of file */
Call lineout tmpfitname, ' '
data = clientbootdrv':\OS2VER' || blkspace || newOS2'\OS2VER'
Call Lineout tmpfitname, data
end
Call Lineout tmpfitname /* close file */
Call Lineout fitname /* close file */
/* rename original client.FIT */
'@rename 'fitname' 'client'.BAK'
if rc = 0 Then Do
/* rename client.TMP to be client.FIT */
'@rename 'tmpfitname' 'client'.FIT'
if rc = 0 Then Do
/* delete orginal client.FIT */
Call Delete_File bakfitname
end
else Do
/* rename error, try to restore original */
'@rename 'bakfitname' 'client'.FIT'
return 4
end
end
return 0
/* subroutine to delete a file */
Delete_File:
arg delfilename
If stream(delfilename, C, 'query exists') <> '' Then Do
'@DEL 'delfilename
end
return 0