home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1993 #2
/
Image.iso
/
lan
/
21ripl.zip
/
RPLMIG21.CMD
< prev
Wrap
OS/2 REXX Batch file
|
1993-05-27
|
48KB
|
1,326 lines
/* RPLMIG21.CMD - REXX program to upgrade LAN Server to support RIPL of */
/* OS/2 2.1. The following upgrades are preformed: */
/* */
/* - Create DEFALT2A directories and files */
/* - Create DEFALT21 directories */
/* - Install new RIPL support files */
/* - Create os221*.cnf files */
/* - Create server records for os221*.cnf files in RPL.MAP */
/* */
/* Copyright: (C) Copyright IBM Corp. 1993 */
/* */
/* Note 1: All NLS message strings are centrally located in the */
/* subroutine Initialize_NLS_Messages at the end of this */
/* rexx procedure. */
CRLF = '0A0D'X
nulsufix = ' 1>nul 2>nul'
ERROR_INFO_type = 1
SYNTAX_type = 2
SourcePath = 'A:\'
Logfile = ''
displaywarningmsgflag = 0
nummsglines = 0
/* initialize NLS error and informational message strings */
Call Initialize_NLS_Messages ERROR_INFO_type
/* handle command line parameters */
Parse Arg clp.1 clp.2 clp.3 .
Call Process_Input_Parameters clp.1, clp.2, clp.3
If result <> 0 Then Call Error_Exit
/* if logfile specified, delete old log file (if it exists) & log header */
If Logfile <> '' Then Do
Call Delete_File Logfile
msgdata = 'RPLMIG21 ' || message.2 || Date('U') Time()
Call Lineout Logfile, msgdata
If result <> 0 Then Do
Say errprefix || message.3 || Logfile
exit 4
end
Call Lineout Logfile, ' '
end
Call Determine_Boot_Drive
If result <> 0 Then Call Error_Exit
Call Determine_RIPL_Directory
If result <> 0 Then Call Error_Exit
Call Determine_LAN_Server_Version
If result <> 0 Then Call Error_Exit
/* verify OS/2 2.1 is installed in RIPL tree */
syslevel = '\OS2\INSTALL\SYSLEVEL.OS2'
If File_Exist(rpldir'\OS2.21'syslevel) = 0 Then Do
/* OS/2 2.1 is not installed in RIPL tree */
Call Display_Log_Msg errprefix || message.14, ''
Call Error_Exit
end
/* check to see if 2.1 migration has alread been run. */
filename = rpldir'\RPLMIG21.$$$'
If File_Exist(filename) <> 0 Then Do
/* RPLMIG21 has already been run, rerun? */
Call Display_Log_Msg message.24, ''
Pull dummy
dummy = translate(dummy)
If dummy = noresponse Then return
else Do
'@attrib -r ' filename
Call Delete_File filename
end
end
/* create DEFALT2A directories/files */
Call Create_DEFALT2A
If result <> 0 Then return 4
Call Display_Log_Msg message.22, ''
/* create DEFALT21 subdirectories */
Call Create_DEFALT21_Directories
/* copy new/changed RIPL files */
Call Copy_RIPL_Files
If result <> 0 Then Call Error_Exit
/* update server name references in new DEFALT21.FIT */
Call Update_DEFALT21_FIT
If result <> 0 Then Do
Call Display_Log_Msg errprefix || message.8, ''
Call Error_Exit
end
else Call Display_Log_Msg message.17, ''
If LS_version = 2 Then Do
/* new SYSTEM.INI and PROGMAN.INI default boot drive id to Z: */
/* for LS 2.0, this must be changed back to C: */
Call Update_SYSTEM_INI
Call Update_bootdrv_references 'Z', 'C', 'PROGMAN.INI'
end
If LS_version = 3 Then Do
/* update boot drive references in ATM.INI and MSD.INI to be Z: */
Call Update_bootdrv_references 'C', 'Z', 'ATM.INI'
Call Update_bootdrv_references 'C', 'Z', 'MSD.INI'
end
/* copy *.INI and *.GRP files to DEFALT21 tree */
fpath = rpldir'\OS2.21\OS2\MDOS\WINOS2\'
srcfile2 = fpath || '*.INI'
trg2 = lanpath'\RPLUSER\DEFALT21\OS2\MDOS\WINOS2\'
Call Display_Log_Msg message.18, srcfile2, trg2
'@XCOPY 'srcfile2 trg2 nulsufix
srcfile2 = fpath || '*.GRP'
Call Display_Log_Msg message.18, srcfile2, trg2
'@XCOPY 'srcfile2 trg2 nulsufix
/* update the RPL.MAP file to add server records for 2.1 and verify */
/* field 12 of workstation record is valid */
Call Update_RPL_MAP
Call Display_Log_Msg message.15, ''
/* create the os221*.cnf files */
Call Create_os221_cnf_files
Call Display_Log_Msg message.16, ''
/* update master CONFIGRI.20 files */
Call Update_Master_Configri_20
Call Display_Log_Msg message.21, ''
If displaywarningmsgflag = 1 Then Do
/* default INI files do not exist, display warning */
Call Display_Log_Msg ' ', ''
Call Display_Log_Msg warnprefix || message.23, srcfile2, trg2
Call Display_Log_Msg ' ', ''
end
/* create special migration file to indicate that migration is complete */
/* migration file is marked READ-ONLY */
rplm21 = rpldir'\RPLMIG21.$$$'
Call lineout rplm21, message.15
Call lineout rplm21, message.16
Call lineout rplm21
'@attrib +r 'rplm21 '1>nul'
If Logfile <> '' Then Do
Call Lineout Logfile
end
exit 0
/* start of subroutines */
/* This subroutine handles the error exit cleanup. */
Error_Exit:
If Logfile <> '' Then Do
Call Lineout Logfile
end
exit 4
/* subroutine to test for existance of a file */
File_Exist:
Arg testfilename
If stream(testfilename, C, 'query exists') <> '' Then rc = 1
else rc = 0
return rc
/* subroutine to delete a file */
Delete_File:
arg delfilename
If stream(delfilename, C, 'query exists') <> '' Then Do
'@DEL 'delfilename
end
return 0
/* subroutine to display/log messages */
/* This routine attempts to format the message line based on format */
/* controls imbedded in each line. */
Display_Log_Msg:
Parse Arg msgstring, parm.1, parm.2, parm.3, parm.4, parm.5, parm.6
if parm.1 <> '' Then Do
/* substitution data supplied */
startpoint = 1
newmsg = ''
sdpos = pos('%', msgstring, startpoint)
Do while sdpos <> 0
j = substr(msgstring, sdpos+1, 1)
newmsg = newmsg || substr(msgstring, startpoint, sdpos-startpoint) || parm.j
startpoint = sdpos+2
sdpos = pos('%', msgstring, startpoint)
end
newmsg = newmsg || substr(msgstring, startpoint)
msgstring = newmsg
end
If substr(msgstring, 1, length(errprefix)) = errprefix Then errprefixflag = 1
else errprefixflag = 0
If substr(msgstring, 1, length(warnprefix)) = warnprefix Then warnprefixflag = 1
else warnprefixflag = 0
/* display/log message 1 line at a time, max line length is 75 characters */
dataflag = 1
msgline = ''
tablength = 0
indentlength = 0
indentvalue = 0
Do while dataflag = 1
/* look for special formatting commands at start of line */
do formati = 1 to 2
testword = word(msgstring, 1)
If substr(testword, 1, 2) = '%T' Then Do
/* special tab command at start of line */
tablength = substr(testword, 3)
indentvalue = 0
/* remove tab command from line */
tabp = pos('%T', msgstring)
msgstring = strip(substr(msgstring, tabp+length(testword)+1), 'L')
end
else Do
If substr(testword, 1, 2) = '%I' Then Do
/* special indent command at start of line */
indentlength = substr(testword, 3)
/* remove indent command from line */
tabp = pos('%I', msgstring)
msgstring = strip(substr(msgstring, tabp+length(testword)+1), 'L')
end
else Leave
end
end
startscanpos = 75 - tablength - indentvalue
lenmsgstring = length(msgstring)
If lenmsgstring <> 0 Then Do
If lenmsgstring > startscanpos Then Do
/* check for CRLF in string */
crlfp = pos(CRLF, msgstring)
If crlfp <> 0 Then Do
If crlfp <= startscanpos Then Do
If crlfp <> 1 Then Do
/* force end of line at CRLF and discard CRLF */
msgline = msgline || substr(msgstring, 1, crlfp-1)
msgstring = strip(substr(msgstring, crlfp+2), 'L')
end
end
else crlfp = 0
end
If crlfp = 0 Then Do
/* find last blank prior to startscanpos */
endline = lastpos(' ', msgstring, startscanpos)
If endline > 0 Then Do
msgline = msgline || substr(msgstring, 1, endline)
msgstring = substr(msgstring, endline+1)
If substr(msgstring, 1, 2) = CRLF Then Do
/* special case, this CRLF can be ignored */
msgstring = strip(substr(msgstring, 3), 'L')
end
end
else Do
/* no space, break word */
msgline = substr(msgstring, 1, startscanpos)
msgstring = substr(msgstring, startscanpos+1)
end
end
end
else Do
/* line less than max length allowed */
crlfp = pos(CRLF, msgstring)
If crlfp <> 0 Then Do
/* get message up to CRLF, discard CRLF */
msgline = substr(msgstring, 1, crlfp-1)
msgstring = substr(msgstring, crlfp+2)
end
else Do
/* only thing left if message */
msgline = msgline || msgstring
msgstring = ''
end
end
If tablength <> 0 Then Do
/* insert required number of spaces at start of line */
msgline = copies(' ',tablength) || msgline
end
If indentvalue <> 0 Then Do
/* add in indentation value blanks */
msgline = copies(' ', indentvalue) || msgline
end
If Logfile = '' Then Do
/* display message locally */
Say msgline
If syntaxhelpflag = 1 Then Do
nummsglines = nummsglines + 1
If nummsglines >= maxmsglines Then Do
/* prompt user to press Enter to see next part of message */
Say message.22
Pull dummy .
/* clear screen */
'CLS'
Say ' ' /* dummy first line */
/* redisplay last line of last screen */
Say msgline
nummsglines = 2
end
end
If indentlength <> 0 Then Do
indentvalue = indentlength
indentlength = 0
end
end
else Do
/* log message */
Call lineout Logfile, msgline
nummsglines = nummsglines+1
end
msgline = ''
If length(msgstring) = 0 Then dataflag = 0
else Do
/* if errprefix present, insert blanks at start of next msg line */
If errprefixflag = 1 then msgline = copies(' ', length(errprefix))
If warnprefixflag = 1 then msgline = copies(' ', length(warnprefix))
end
end
else dataflag = 0
end
return 0
Determine_Installed_OS2_Levels:
syslevel = '\OS2\INSTALL\SYSLEVEL.OS2'
If File_Exist(rpldir'\OS2'syslevel) = 1 Then os213 = 1
else os213 = 0
If File_Exist(rpldir'\OS2.20'syslevel) = 1 Then os220 = 1
else os220 = 0
If File_Exist(rpldir'\OS2.20a'syslevel) = 1 Then os220a = 1
else os220a = 0
If File_Exist(rpldir'\OS2.21'syslevel) = 1 Then os221 = 1
else os221 = 0
return
/* This subroutine determines the version of LAN Server installed on */
/* the Remote IPL server. */
Determine_LAN_Server_Version:
/* Read the first 60 bytes of SYSLEVEL.SRV and check the current server */
/* level. */
filename = lanpath'\SYSLEVEL.SRV'
syslevel = ''
/* read syslevel file, try to get it with a single linein call */
syslevel = Linein(filename)
Call Lineout filename /* close file */
If Length(syslevel) < 60 Then Do
/* single linein did not get enought of file, get syslevel */
/* character at a time */
Do i = 1 to 60
syslevel = syslevel || charin(filename)
end
Call Charout filename
end
/* get current csdlevel */
verp = pos('IP', syslevel)
csdlevel = substr(syslevel, verp, 8)
If verp <> 0 Then Do
/* recognize any level of LS 2.0 but only recognize initial release */
/* of LS 3.0 */
If substr(csdlevel, 4, 1) = '6' Then LS_version = 2
else If substr(csdlevel, 4, 1) = '7' Then Do
If substr(csdlevel, 5, 3) = '000' Then LS_version = 3
else LS_version = '3x'
end
else LS_version = ''
end
If LS_version = '' Then Do
/* not LS 2.0 or LS 3.x */
msgdata = errprefix || message.11
Call Display_Log_Msg msgdata, csdlevel
return 4
end
else If LS_version = '3x' Then Do
/* not initial LS 3.0 release */
msgdata = errprefix || message.12
Call Display_Log_Msg msgdata, csdlevel
return 4
end
return 0
/* create new subdirectories for DEFALT21 */
Create_DEFALT21_Directories:
Call Display_Log_Msg message.20, ''
rplpath = rpldir'\MACHINES\DEFALT21'
/* create MACHINES\DEFALT21 tree */
'@MD ' rplpath nulsufix
'@MD ' rplpath || '\IBMLAN' nulsufix
/* create \IBMLAN\RPLUSER\DEFALT21 tree */
rupath = lanpath'\RPLUSER\DEFALT21'
'@MD 'rupath nulsufix
'@MD 'rupath || '\IBMLAN' nulsufix
'@MD 'rupath || '\IBMLAN\LOGS' nulsufix
'@MD 'rupath || '\IBMLAN\PROFILES' nulsufix
'@MD 'rupath || '\IBMLAN\ACCOUNTS' nulsufix
'@MD 'rupath || '\IBMCOM' nulsufix
'@MD 'rupath || '\SPOOL' nulsufix
'@MD 'rupath || '\OS2' nulsufix
'@MD 'rupath || '\OS2\MDOS' nulsufix
'@MD 'rupath || '\OS2\MDOS\WINOS2' nulsufix
'@MD 'rupath || '\OS2\SYSTEM' nulsufix
return 0
/* copy new/updated RIPL files to server */
Copy_RIPL_Files:
/* copy files to DEFALT21 tree */
defalt2x = 'DEFALT21'
/* copy requester IBMLAN.INI to DEFALT2x tree */
srcfile = rpldir'\MACHINES\DEFALT20\IBMLAN\IBMLAN.INI'
trg = rpldir'\MACHINES\' || defalt2x || '\IBMLAN\'
Call Display_Log_Msg message.18, srcfile, trg
'@COPY 'srcfile trg nulsufix
If rc = 0 Then Do
rplupath = lanpath || '\RPLUSER\'
/* copy NET.ACC from DEFALT20 to DEFALT21 */
srcfile = rplupath || 'DEFALT20\IBMLAN\ACCOUNTS\NET.ACC'
trg = rplupath || defalt2x || '\IBMLAN\ACCOUNTS\'
Call Display_Log_Msg message.18, srcfile, trg
'@COPY 'srcfile trg nulsufix
If rc = 0 Then Do
/* copy AUTOEXEC.20 from DEFALT20 TO DEFALT21 */
srcfile = rplupath || 'DEFALT20\AUTOEXEC.20'
trg = rplupath || defalt2x
Call Display_Log_Msg message.18, srcfile, trg
'@COPY 'srcfile trg nulsufix
end
end
If rc <> 0 Then Do
Call Display_Log_Msg errprefix || message.9, srcfile, trg
return 4
end
/* start processing new files */
/* rename old RPLSETD.CMD, if it exists */
If File_Exist(rpldir'\RPLSETD.CMD') = 1 Then Do
/* rename old version of RPLSETD.CMD in RPL directory */
'@RENAME 'rpldir'\RPLSETD.CMD RPLSETD.OLD' nulsufix
end
/* unzip common RPL*.* files to \IBMLAN\NETPROG */
trg = lanpath'\NETPROG\'
srcfile = SourcePath'IBMLS.ZIP'
srcfile2 = srcfile || '\RPL*.*'
Call Display_Log_Msg message.19, srcfile2, trg
'@'lanpath'\INSTALL\PKUNZIP2 -o 'srcfile trg 'RPL*.*' nulsufix
If rc <> 0 Then Do
Call Display_Log_Msg errprefix || message.10, srcfile2, trg
return 4
end
/* unzip dummy \IBMLAN\RPL\RPLSETD.CMD */
trg = lanpath'\RPL\'
srcfile = SourcePath'IBMLS.ZIP'
srcfile2 = srcfile || '\DRPLSETD.CMD'
Call Display_Log_Msg message.19, srcfile2, trg
'@'lanpath'\INSTALL\PKUNZIP2 -o 'srcfile trg 'DRPLSETD.CMD' nulsufix
If rc <> 0 Then Do
Call Display_Log_Msg errprefix || message.10, srcfile2, trg
return 4
end
/* rename DRPLSETD.CMD to RPLSETD.CMD */
'@RENAME 'rpldir'\DRPLSETD.CMD RPLSETD.CMD' nulsufix
/* copy new DEFALT21.FIT */
trg = rpldir'\FITS\'
srcfile2 = srcfile || '\DEFALT21.FIT'
Call Display_Log_Msg message.19, srcfile2 , trg
'@'lanpath'\INSTALL\PKUNZIP2 -o 'srcfile trg 'DEFALT21.FIT' nulsufix
If rc <> 0 Then Do
Call Display_Log_Msg errprefix || message.10, srcfile2, trg
return 4
end
/* PROGMAN.INI, if necessary, backup old file */
fpath = rpldir'\OS2.21\OS2\MDOS\WINOS2\'
srcfile2 = fpath || 'PROGMAN.INI'
trg2 = fpath || 'PROGMAN.IN_'
If File_Exist(trg2) = 0 Then '@COPY 'srcfile2 trg2 nulsufix
/* SYSTEM.INI, if necessary, backup old file */
srcfile2 = fpath || 'SYSTEM.INI'
trg2 = fpath || 'SYSTEM.IN_'
If File_Exist(trg2) = 0 Then '@COPY 'srcfile2 trg2 nulsufix
/* copy new WINOS2 support files */
trg = fpath
srcfile2 = srcfile || '\*.INI'
Call Display_Log_Msg message.19, srcfile2, trg
'@'lanpath'\INSTALL\PKUNZIP2 -o 'srcfile trg '*.INI' nulsufix
If rc <> 0 Then Do
Call Display_Log_Msg errprefix || message.10, srcfile2, trg
return 4
end
/* copy default client INI files to DEFALT21 tree */
fpath = rpldir'\OS2.21\OS2\'
srcfile2 = fpath || 'RPOS2TMP.INI'
trg2 = lanpath'\RPLUSER\DEFALT21\OS2\OS2INI.20'
If File_Exist(srcfile2) Then Do
/* copy RPOS2TMP.INI to OS2INI.20 */
Call Display_Log_Msg message.18, srcfile2, trg2
'@COPY 'srcfile2 trg2 nulsufix
If rc = 0 Then Do
/* copy RPOS2SYS.INI to OS2SYINI.20 */
srcfile2 = fpath || 'RPOS2SYS.INI'
trg2 = lanpath'\RPLUSER\DEFALT21\OS2\OS2SYINI.20'
Call Display_Log_Msg message.18, srcfile2, trg2
'@COPY 'srcfile2 trg2 nulsufix
end
If rc <> 0 Then Do
Call Display_Log_Msg errprefix || message.9, srcfile2, trg2
return 4
end
end
else Do
/* default INI files do not exist, set flag to display warning at exit */
displaywarningmsgflag = 1
end
/* unzip version EXE files, build source path based on version */
srcfile = SourcePath'IBMLS'
If LS_version = 2 Then srcfile = srcfile || '20.ZIP'
else srcfile = srcfile ||'30.ZIP'
/* if necessary, backup old files common to LS 2.0 and 3.0 */
backuplst.0 = 2
backuplst.1 = 'RMM1.EXE'
backuplst.2 = 'GETRPL.EXE'
do i = 1 to backuplst.0
srcfile2 = lanpath'\NETPROG\' || backuplst.i
trg2 = substr(srcfile2, 1 , length(srcfile2)-1) || '_'
If File_Exist(trg2) = 0 Then '@COPY 'srcfile2 trg2 nulsufix
end
/* unzip *.EXE files */
trg = lanpath'\NETPROG\'
srcfile2 = srcfile || '\*.EXE'
Call Display_Log_Msg message.19, srcfile2 , trg
'@'lanpath'\INSTALL\PKUNZIP2 -o 'srcfile trg '*.EXE' nulsufix
If rc <> 0 Then Do
Call Display_Log_Msg errprefix || message.10, srcfile2, trg
return 4
end
/* process version unique files */
If LS_version = 2 Then Do
/* LAN Server version is 2.0 */
srcfile = SourcePath'IBMLS20.ZIP'
If substr(csdlevel, 4, 4) = '6000' Then Do
/* NETWKSTA.200 and MFSD20.SYS must be replace for level 6000 */
/* NETWKSTA.200, if necessary, backup old file */
srcfile2 = lanpath'\NETPROG\NETWKSTA.200'
trg2 = substr(srcfile2, 1, length(srcfile2)-1) || '_'
If File_Exist(trg2) = 0 Then '@COPY 'srcfile2 trg2 nulsufix
/* unzip NETWKSTA.200 */
trg = lanpath'\NETPROG\'
srcfile2 = srcfile || '\NETWKSTA.200'
Call Display_Log_Msg message.19, srcfile2 , trg
'@'lanpath'\INSTALL\PKUNZIP2 -o 'srcfile trg 'NETWKSTA.200' nulsufix
If rc <> 0 Then Do
Call Display_Log_Msg errprefix || message.10, srcfile2, trg
return 4
end
/* copy to RPL tree */
srcfile2 = rpldir'\IBMLAN\NETPROG\NETWKSTA.200'
trg2 = substr(srcfile2, 1, length(srcfile2)-1) || '_'
If File_Exist(trg2) = 0 Then '@COPY 'srcfile2 trg2 nulsufix
srcfile2 = lanpath'\NETPROG\NETWKSTA.200'
trg2 = rpldir'\IBMLAN\NETPROG\'
Call Display_Log_Msg message.18, srcfile2, trg2
'@COPY 'srcfile2 trg2 nulsufix
/* MFSD20.SYS, if necessary, backup old file */
srcfile2 = rpldir'\OS2\MFSD20.SYS'
trg2 = substr(srcfile2, 1, length(srcfile2)-1) || '_'
If File_Exist(trg2) = 0 Then '@COPY 'srcfile2 trg2 nulsufix
/* unzip MFSD20.SYS, note different directory from LS 3.0 */
trg = rpldir'\OS2\'
srcfile2 = srcfile || '\MFSD20.SYS'
Call Display_Log_Msg message.19, srcfile2 , trg
'@'lanpath'\INSTALL\PKUNZIP2 -o 'srcfile trg 'MFSD20.SYS' nulsufix
If rc <> 0 Then Do
Call Display_Log_Msg errprefix || message.10, srcfile2, trg
return 4
end
end
end
else Do
/* LAN Server version is 3.0 */
srcfile = SourcePath'IBMLS30.ZIP'
/* MFSD20.SYS, if necessary, backup old file */
srcfile2 = rpldir'\DOS\MFSD20.SYS'
trg2 = rpldir'\DOS\MFSD20.SY_'
If File_Exist(trg2) = 0 Then '@COPY 'srcfile2 trg2 nulsufix
/* unzip MFSD20.SYS, note different directory from LS 2.0 */
trg = rpldir'\DOS\'
srcfile2 = srcfile || '\MFSD20.SYS'
Call Display_Log_Msg message.19, srcfile2, trg
'@'lanpath'\INSTALL\PKUNZIP2 -o 'srcfile trg 'MFSD20.SYS' nulsufix
If rc <> 0 Then Do
Call Display_Log_Msg errprefix || message.10, srcfile2, trg
return 4
end
/* RMM1PANA.LIB, if necessary, backup old file */
srcfile2 = lanpath'\NETPROG\RMM1PANA.LIB'
trg2 = substr(srcfile2, 1 , length(srcfile2)-1) || '_'
If File_Exist(trg2) = 0 Then '@COPY 'srcfile2 trg2 nulsufix
/* unzip RMM1PANA.LIB */
trg = lanpath'\NETPROG\'
srcfile2 = srcfile || '\RMM1PANA.LIB'
Call Display_Log_Msg message.19, srcfile2, trg
'@'lanpath'\INSTALL\PKUNZIP2 -o 'srcfile trg 'RMM1PANA.LIB' nulsufix
If rc <> 0 Then Do
Call Display_Log_Msg errprefix || message.10, srcfile2, trg
return 4
end
end
/* subroutine updates all the server name references in the DEFALT21.FIT, */
/* If LS 2.0 changes Z: references to C: */
Update_DEFALT21_FIT:
/* get server name from first record in DEFALT20.FIT */
fit20 = rpldir'\FITS\DEFALT20.FIT'
data = linein(fit20)
Call stream fit20,C,'close'
spos = pos('\', data, 3)
If spos <> 0 Then servername = substr(data, 3, spos-3)
else Do
/* error */
Call Display_Log_Msg errprefix || message.7, ''
return 4
end
/* read each DEFALT21.FIT record and update server name references */
fit21 = rpldir'\FITS\DEFALT21.FIT'
tmpfit21 = rpldir'\FITS\DEFALT21.TMP'
do until lines(fit21) = 0
data = linein(fit21)
ucdata = translate(data)
serverp = pos('\\SERVER\', ucdata)
if serverp <> 0 Then Do
/* replace with real server name */
newdata = substr(data, 1, serverp+1)||servername||,
substr(data, serverp+8)
data = newdata
end
If LS_version = 2 Then Do
/* check for Z:\ references */
bootdrvp = pos('Z:\', ucdata)
If bootdrvp <> 0 Then Do
/* change Z:\ references to C:\ references */
If bootdrvp = 1 Then newdata = 'C' || substr(data, 2)
else newdata = substr(data, 1, bootdrvp-1) || 'C' ||,
substr(data, bootdrvp+1)
data = newdata
end
end
Call lineout tmpfit21, data
end
Call lineout tmpfit21
Call lineout fit21
'@RENAME 'fit21 ' DEFALT21.BAK' nulsufix
'@RENAME 'tmpfit21 ' DEFALT21.FIT' nulsufix
Call Delete_File rpldir'\FITS\DEFALT21.BAK'
return 0
/* subroutine to update boot drive references to C: and D: */
Update_SYSTEM_INI:
fpath = rpldir'\OS2.21\OS2\MDOS\WINOS2\'
srcfile = fpath || 'SYSTEM.INI'
trgfile = fpath || 'SYSTEM.TMP'
Call Delete_File trgfile
Call Delete_File fpath || 'SYSTEM.BAK'
count = 1
/* update Pagingfile= records, they are the only records with boot */
/* drive references in them */
Do while lines(srcfile) <> 0
data = linein(srcfile)
ucdata = translate(data)
dpos = pos('PAGINGFILE=', ucdata)
If dpos <> 0 Then Do
/* record found */
newdata = substr(data, 1, dpos+10)
If count = 1 Then Do
/* first record is for local drive which will be D */
newdata = newdata || 'D'
count = 2
end
else Do
/* second record is for RIPL server which will be C */
newdata = newdata || 'C'
end
dpos = pos(':', data)
If dpos <> 0 Then newdata = newdata || substr(data, dpos)
else newdata = newdata || ':\WIN386.SWP'
data = newdata
end
Call Lineout trgfile, data
end
/* close files */
Call Lineout srcfile
Call Lineout trgfile
/* rename files */
'@RENAME ' srcfile ' SYSTEM.BAK 'nulsufix
'@RENAME ' trgfile ' SYSTEM.INI 'nulsufix
Call Delete_File fpath || 'SYSTEM.BAK'
return
/* subroutine to update boot drive references in a file */
Update_bootdrv_references:
parse arg oldbootdrv, newbootdrv, filename
fpath = rpldir'\OS2.21\OS2\MDOS\WINOS2\'
srcfile = fpath || filename
fname = substr(filename, 1, length(filename)-3)
trgfile = fpath || fname || 'TMP'
Call Delete_File trgfile
Call Delete_File fpath || fname || 'BAK'
/* locate any old boot drive references and change them to new boot */
/* drive references */
Do while lines(srcfile) <> 0
data = linein(srcfile)
ucdata = translate(data)
dpos = pos(oldbootdrv || ':\', ucdata)
If dpos <> 0 Then Do
newdata = substr(data, 1, dpos-1) || newbootdrv ||,
substr(data, dpos+1)
data = newdata
end
Call Lineout trgfile, data
end
/* close files */
Call Lineout srcfile
Call Lineout trgfile
/* rename files */
'@RENAME ' srcfile fname || 'BAK ' nulsufix
'@RENAME ' trgfile filename nulsufix
Call Delete_File fpath || fname || 'BAK'
return
/* this subroutine creates the DEFALT2A directories and files from DEFALT20 */
Create_DEFALT2A:
/* create MACHINES\DEFALT2A */
srcfile = rpldir'\MACHINES\DEFALT20\*.*'
trg = rpldir'\MACHINES\DEFALT2A\'
Call Display_Log_Msg message.18, srcfile, trg
'@XCOPY 'srcfile trg '/E /S' nulsufix
If rc = 0 Then Do
/* create RPLUSER\DEFALT2A */
srcfile = lanpath'\RPLUSER\DEFALT20\*.*'
trg = lanpath'\RPLUSER\DEFALT2A\'
Call Display_Log_Msg message.18, srcfile, trg
'@XCOPY 'srcfile trg '/E /S' nulsufix
end
If rc <> 0 Then Do
Call Display_Log_Msg errprefix || message.9, srcfile, trg
return 4
end
/* backup existing file and delete original */
fit20 = rpldir'\FITS\DEFALT20.FIT'
fit2A = rpldir'\FITS\DEFALT2A.FIT'
If File_Exist(fit2A) Then Do
/* backup existing file */
'@COPY 'fit2A substr(fit2A, 1, length(fit2A)-3) || 'BAK' nulsufix
/* delete file */
Call Delete_File fit2A
end
/* read each DEFALT20.FIT record, update DEFALT20 and OS2.20 references, */
/* and copy to DEFALT2A.FIT */
do until lines(fit20) = 0
data = linein(fit20)
ucdata = translate(data)
defalt20p = pos('DEFALT20', ucdata)
if defalt20p <> 0 Then Do
/* replace with DEFALT2A */
newdata = substr(data, 1, defalt20p-1)||'DEFALT2A'||,
substr(data, defalt20p+8)
data = newdata
end
os220p = pos('OS2.20\', ucdata)
if os220p <> 0 Then Do
/* replace OS2.20 with OS2.20a */
newdata = substr(data, 1, os220p+5) || 'a' ||,
substr(data, os220p+6)
data = newdata
end
Call lineout fit2A, data
end
Call lineout fit2A
Call lineout fit20
return 0
/* This subroutine updates RPL.MAP to support OS/2 2.1 server records */
Update_RPL_MAP:
Call Determine_Installed_OS2_Levels
rplmap = rpldir'\RPL.MAP'
rplmaptmp = rpldir'\RPLMAP.TMP'
Call Delete_File rplmaptmp
i = 1
os221flag = 0
srvrec.0 = 0
do until lines(rplmap) = 0
data = linein(rplmap)
ucdata = translate(data)
psrv = pos('YYYYYYYYYYYY', ucdata)
if psrv <> 0 & psrv < 3 Then Do
/* server record, check for OS/2 type */
pos2 = pos('OS2BB', ucdata)
if pos2 <> 0 Then Do
/* OS/2 1.3, determine if it should be enabled or disabled */
If os213 = 1 Then Do
/* should be enabled */
If substr(data, 1, 1) = ';' Then data = substr(data, 2)
end
else Do
/* should be disabled */
If substr(data, 1, 1) <> ';' Then data = ';'data
end
end
else Do
pos2 = pos('OS220', ucdata)
if pos2 <> 0 Then Do
/* OS/2 2.0 type, save it */
srvrec.0 = i
srvrec.i = data
i = i + 1
/* determine if it should be enabled or disabled */
If os220 = 1 Then Do
/* should be enabled, maybe */
If substr(data, 1, 1) = ';' Then Do
/* enable except for 3COM entries */
If pos('OS2203E', ucdata) = 0 Then data = substr(data, 2)
end
end
else Do
/* should be disabled */
If substr(data, 1, 1) <> ';' Then data = ';'data
end
end
else Do
/* check for OS2.20a record */
pos2 = pos('OS22A', ucdata)
If pos2 <> 0 Then Do
/* os2.20a, determine if it should be enabled or disabled */
If os220a = 1 Then Do
/* should be enabled, maybe */
If substr(data, 1, 1) = ';' Then Do
/* enable except for 3COM entries */
If pos('OS22A3E', ucdata) = 0 Then data = substr(data, 2)
end
end
else Do
/* should be disabled */
If substr(data, 1, 1) <> ';' Then data = ';'data
end
end
else Do
/* check for existing 2.1 server record */
pos2 = pos('OS221', ucdata)
If pos2 <> 0 Then os221flag = 1
else Do
/* check for last server record */
pos2 = pos('PCINIT.CNF', ucdata)
If pos2 <> 0 Then Do
/* end of server records, do we need to create new records? */
If os221flag = 0 Then Do
If srvrec.0 <> 0 Then Do
/* need to create OS/2 2.1 records, use saved */
/* OS220 records as a master */
Do j = 1 to srvrec.0
/* locate OS/2 cnf entry in field 2 */
pos2 = pos('OS220', translate(srvrec.j))
newdata = substr(srvrec.j, 1, pos2+3) || '1'
startpoint = pos2+5
/* locate OS type in field 7 */
pos2 = pos('~2.0~', srvrec.j, startpoint)
If pos2 <> 0 Then Do
/* LS 3.0 record format */
newdata = newdata ||,
substr(srvrec.j, startpoint, (pos2+3)-startpoint)
newdata = newdata || '1'
startpoint = pos2 + 4
end
else Do
pos2 = pos('~20~', srvrec.j, startpoint)
If pos2 <> 0 Then Do
/* LS 2.0 record format */
newdata = newdata ||,
substr(srvrec.j, startpoint, (pos2+2)-startpoint)
newdata = newdata || '.1'
startpoint = pos2 + 3
end
else Do
/* type not recognized, doing nothing */
/* will cause existing description */
/* (field 7) to be used. */
end
end
/* locate OS type in field 12 */
pos2 = pos('_20_', srvrec.j, startpoint)
newdata = newdata || substr(srvrec.j, startpoint, (pos2+2)-startpoint)
newdata = newdata || '1'
startpoint = pos2 + 3
newdata = newdata || substr(srvrec.j, startpoint)
if substr(newdata, 1, 1) = ';' Then Do
ucnewdata = translate(newdata)
pos2 = pos('OS221', ucnewdata)
adaptype = substr(ucnewdata, pos2+5, 3)
/* if not 3COM entry, enable record */
If adaptype <> '3EI' & adaptype <> '3EM' Then newdata = substr(newdata, 2)
end
Call lineout rplmaptmp, newdata
end
end
end
end
end
end
end
end
end
else Do
pos2 = pos('1000FFFFFFFF', data)
if pos2 <> 0 Then Do
/* OS2 default workstation record, try to make sure fields 4 & 12 */
/* are valid */
field12 = word(data, 12)
pf12 = pos(field12, data)
os2type = substr(field12, 3, 2)
f12flag = 1
If os2type = '20' & os220 = 0 Then f12flag = 0
else If os2type = '2A' & os220a = 0 Then f12flag = 0
else If os2type = '21' & os221 = 0 Then fl12flag = 0
else If substr(os2type, 1, 1) = 'O' & os213 = 0 Then fl12flag = 0
If f12flag = 0 Then Do
/* field 12 is invalid, therefore so is field 4, update */
/* them so they are valid */
If os220 = 1 Then os2type = '20'
else If os220a = 1 Then os2type = '2A'
else If os221 = 1 Then os2type = '21'
else os2type = '21' /* default to 21 */
If os2type <> '' Then Do
field4 = word(data, 4)
pf4 = pos(field4, data)
pf4 = pf4 + length(field4) - 3
If os2type = '2A' Then newdata = substr(data, 1, pf4) || '20'
else newdata = substr(data, 1, pf4) || os2type
newdata = newdata || substr(data, pf4+3, pf12-pf4-1) || os2type
data = newdata || substr(data, pf12+4)
end
end
end
end
Call lineout rplmaptmp, data
end
Call lineout rplmap
Call lineout rplmaptmp
If os221flag = 0 Then Do
/* replace old RPL.MAP with new RPL.MAP */
rplmapxxx = 'RPLMAP.xxx'
Call Delete_File rpldir'\'rplmapxxx
'@rename 'rplmap rplmapxxx nulsufix
'@rename 'rplmaptmp 'RPL.MAP'nulsufix
Call Delete_File rpldir'\'rplmapxxx
end
else Call Delete_File rpldir'\'rplmaptmp
return
/* This subroutine creates CNF file for OS/2 2.1 */
Create_os221_cnf_files:
/* build list of possible source cnf filenames */
cnflist.0 = 5
cnflist.1 = 'os220tr'
cnflist.2 = 'os220et'
cnflist.3 = 'os220pc'
cnflist.4 = 'os2203ei'
cnflist.5 = 'os2203em'
Do i = 1 to cnflist.0
srccnffile = rpldir'\'cnflist.i'.cnf'
trgcnffile = rpldir'\'substr(cnflist.i,1,4)'1'substr(cnflist.i,6)'.cnf'
If File_Exist(srccnffile) = 1 Then Do
/* source file exists, check target file */
If File_Exist(trgcnffile) = 0 Then Do
/* file does not exist, create it */
do until lines(srccnffile) = 0
data = linein(srccnffile)
ucdata = translate(data)
pos2 = pos('OS2.20\', ucdata)
if pos2 <> 0 Then Do
/* update OS/2 directory reference */
newdata = substr(data, 1, pos2+4) || '1' || substr(data, pos2+6)
data = newdata
end
Call lineout trgcnffile, data
end
Call lineout srccnffile
Call lineout trgcnffile
end
end
end
return
/* Subroutine Update_Master_Configri_20 */
/* This subroutine creates new master CONFIGRI.20 files that have the */
/* DRIVER=x:\OS2\TESTCFG.SYS statement added to it */
Update_Master_Configri_20:
/* build list of directories in RPL\IBMCOM to process */
lanlist.0 = 6
lanlist.1 = 'TOKENRNG'
lanlist.2 = 'ETHERNET'
lanlist.3 = 'PCNETA'
lanlist.4 = 'PCNET'
lanlist.5 = 'ELNKII'
lanlist.6 = 'ELNKMC'
Do i = 1 to lanlist.0
lantype = lanlist.i
configfilename = rpldir'\IBMCOM\'lantype'\CONFIGRI.20'
If File_Exist(configfilename) <> 0 Then Do
/* build fully qualified path name for master CONFIGRI.20 */
configname = rpldir'\IBMCOM\'lantype'\CONFIGRI.20'
tmpconfigname = rpldir'\IBMCOM\'lantype'\CONFIGRI.20T'
bakconfigname = rpldir'\IBMCOM\'lantype'\CONFIGRI.20B'
/* Call SysFileDelete tmpconfigname */
Call Delete_File tmpconfigname
Call Delete_File bakconfigname
bootdrv = 'Z'
/* copy records looking for TESTCFG.SYS statement */
flag = 0
do until lines(configname) = 0
data = linein(configname)
ucdata = translate(data)
dpos = pos('SET PATH=', ucdata)
if dpos <> 0 Then Do
/* get bootdrive id from SET PATH statement */
dpos = pos(':\OS2;', ucdata)
if dpos <> 0 Then bootdrv = substr(ucdata, dpos-1, 1)
end
dpos = pos('DEVICE=', ucdata)
If dpos <> 0 Then Do
If pos('\OS2\TESTCFG.SYS', ucdata, dpos+7) <> 0 Then Do
/* DEVICE statement already present */
If word(ucdata, 1) = 'REM' Then Do
/* statement REMed out, un-REM it */
newdata = substr(data, dpos)
data = newdata
end
flag = 1
end
end
Call lineout tmpconfigname, data
end
If flag = 0 Then Do
/* add DEVICE statement to end of file */
Call lineout tmpconfigname, 'DEVICE='bootdrv':\OS2\TESTCFG.SYS'
end
Call Lineout tmpconfigname /* close file */
Call Lineout configname /* close file */
/* rename original CONFIGRI.20 */
'@rename 'configname' CONFIGRI.20B'
if rc = 0 Then Do
/* rename CONFIGRI.20T to be CONFIGRI.20 */
'@rename 'tmpconfigname' CONFIGRI.20'
if rc = 0 Then Do
/* delete orginal CONFIGRI.20 */
Call Delete_File bakconfigname
end
else Do
/* rename error, try to restore original */
'@rename 'bakconfigname' CONFIGRI.20'
end
end
end
end
return 0
Determine_Boot_Drive:
/* find the boot driver id */
os2path = value('PATH',,'OS2ENVIRONMENT')
os2p = pos(':\OS2', translate(os2path))
if os2p = 0 Then Do
msgdata = errprefix || message.5
Call Display_Log_Msg msgdata, ''
return 4
end
bootdrv = substr(os2path, os2p-1, 1)
return 0
Determine_RIPL_Directory:
/* find out where IBMLAN is installed */
os2path = value('PATH',,'OS2ENVIRONMENT')
ibmlanp = pos(':\IBMLAN', translate(os2path))
if ibmlanp = 0 Then Do
msgdata = errprefix || message.6
Call Display_Log_Msg msgdata, ''
return 4
end
landrv = substr(os2path, ibmlanp-1, 1)
lanpath = landrv':\IBMLAN'
fname = lanpath'\IBMLAN.INI'
/* read IBMLAN.INI looking for the RPLDIR entry */
do until lines(fname) = 0
data = translate(linein(fname))
rpldirp = pos('RPLDIR', data)
if rpldirp <> 0 then do
rpldirp = pos('=', data)
rpldir = strip(substr(data, rpldirp+1))
Leave
end
end
Call stream fname,C,'close'
if rpldir = '' then do
msgdata = errprefix || message.13
Call Display_Log_Msg msgdata, ''
return 4
end
return 0
/* Process command line parameters */
Process_Input_Parameters:
Arg parm.1, parm.2, parm.3
Do i = 1 to 3
If parm.i = '' Then Leave
parmtype = substr(parm.i,1,2)
select
when parmtype = '?' Then Call Syntax_Help
when parmtype = '/H' Then Call Syntax_Help
when parmtype = '/L' Then Do
/* Logfile parameter */
if substr(parm.i, 3, 1) = ':' Then Logfile = substr(parm.i, 4)
else Logfile = substr(parm.i, 3)
end
when parmtype = '/S' Then Do
/* Sourcepath parameter */
if substr(parm.i, 3, 1) = ':' Then SourcePath = substr(parm.i, 4)
else SourcePath = substr(parm.i, 3)
If substr(SourcePath, length(SourcePath), 1) <> '\' Then Do
/* insure path ends in a \ */
SourcePath = SourcePath || '\'
end
end
otherwise Do
msgdata = errprefix || message.4
Call Display_Log_Msg msgdata, parm.i
return 4
end
end
end
return 0
Syntax_Help:
do i = 30 to 33
Call Display_Log_Msg message.i, ''
end
exit
Initialize_NLS_Messages:
/***********************************************************************/
/* NLS messages */
/* */
/* The following message strings should be translated for NLS support. */
/* */
/* Note: The %1, %2, etc. strings represent dynamic data fields that */
/* are filled in when the message is displayed. Do not */
/* translate the %1, %2, etc. fields. */
/* The 'CRLF,' sequence that ends some lines represents */
/* formatting control (new line) and should not be translated. */
/* However, after translation, each message may need to be */
/* manually reformatted to prevent excessive length message */
/* lines. The message display code does not automatically */
/* reformat long message lines. */
/***********************************************************************/
arg message_type
/* error message prefix */
errprefix = 'ERROR: '
/* warning prefix */
warnprefix = 'WARNING: '
/* yes/no response */
yesresponse = 'Y'
noresponse = 'N'
/* start of error messages */
message.1 = 'Missing keyword in '
message.2 = 'HISTORY LOG: '
message.3 = 'Unable to open the Logfile '
message.4 = 'The option %1 is not a valid option.'
message.5 = 'Unable to determine the boot driver id.'
message.6 = 'Unable to determine where LAN Server is installed.'
message.7 = 'Unable to determine the server name.'
message.8 = 'DEFALT21.FIT was not updated.'
message.9 = 'Error copying %1 to %2.'
message.10 = 'PKUNZIP2 Error while installing %1 to %2.'
message.11 = 'The level of LAN Server installed is %1. This level of',
'LAN Server can not be updated to support OS/2 2.1.'
message.12 = 'The level of LAN Server installed is %1. This level of',
'LAN Server does not need to be upgraded.'
message.13 = 'The RPLDIR parameter was not found in IBMLAN.INI.'
message.14 = 'OS/2 2.1 is not installed in the RIPL directory tree. The OS/2 2.1',
'version of RIPLINST.EXE must be run to install OS/2 2.1 in the',
'RIPL directory tree prior to running RPLMIG21.CMD'
/* start of informational messages */
message.15 = 'RPL.MAP was updated to support OS/2 2.1.'
message.16 = 'OS221*.CNF files were created.'
message.17 = 'DEFALT21.FIT was updated.'
message.18 = 'Copying %1 to %2.'
message.19 = 'Installing %1 to %2.'
message.20 = 'DEFALT21 directories were created.'
message.21 = 'Master CONFIGRI.20 files were updated.'
message.22 = 'DEFALT2A directories and files were created.'
message.23 = 'Default OS/2 2.1 client INI files do not exist. Run the GETRPL',
'utility to create the default INI files before defining any',
'2.1 RIPL client machines.'
message.24 = 'RPLMIG21.CMD has already been run. Do you wish to rerun it (Y/N)?'
/* start of syntax help messages */
message.30 = '%I14 ',
'RPLMIG21.CMD [ ? | /h | /H] [/S:Sourcepath] [/L:Logfile]'CRLF,
' '
message.31 = '%T4 %I11 ',
'where ? or /h or /H is a request for this help panel. If specified, it',
'must be first parameter.'CRLF,
' '
message.32 = '%T10 %I3 ',
'/S:Sourcepath is the fully qualified path to the root directory',
'which contains the files to be installed by RPLMIG21. The',
'default value is A:\.' CRLF,
' '
message.33 = '%T10 %I3 ',
'/L:Logfile is the fully qualified name of a file to which all',
'messages and errors are to be logged. If Logfile is specified,',
'no messages or errors will be displayed on the screen.'CRLF,
' '
return