home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 27 Fixes20 / 27-Fixes20.zip / 21ripl.zip / RPLMIG21.CMD < prev   
OS/2 REXX Batch file  |  1993-05-27  |  48KB  |  1,326 lines

  1. /* RPLMIG21.CMD - REXX program to upgrade LAN Server to support RIPL of      */
  2. /*                OS/2 2.1.  The following upgrades are preformed:           */
  3. /*                                                                           */
  4. /*                  - Create DEFALT2A directories and files                  */
  5. /*                  - Create DEFALT21 directories                            */
  6. /*                  - Install new RIPL support files                         */
  7. /*                  - Create os221*.cnf files                                */
  8. /*                  - Create server records for os221*.cnf files in RPL.MAP  */
  9. /*                                                                           */
  10. /*    Copyright: (C) Copyright IBM Corp. 1993                                */
  11. /*                                                                           */
  12. /*    Note 1: All NLS message strings are centrally located in the           */
  13. /*            subroutine Initialize_NLS_Messages at the end of this          */
  14. /*            rexx procedure.                                                */
  15.  
  16. CRLF = '0A0D'X
  17. nulsufix = ' 1>nul 2>nul'
  18. ERROR_INFO_type = 1
  19. SYNTAX_type = 2
  20. SourcePath = 'A:\'
  21. Logfile = ''
  22. displaywarningmsgflag = 0
  23. nummsglines = 0
  24.  
  25. /* initialize NLS error and informational message strings */
  26. Call Initialize_NLS_Messages ERROR_INFO_type
  27.  
  28. /* handle command line parameters */
  29. Parse Arg  clp.1 clp.2 clp.3 .
  30. Call Process_Input_Parameters clp.1, clp.2, clp.3
  31. If result <> 0 Then Call Error_Exit
  32.  
  33. /* if logfile specified, delete old log file (if it exists) & log header */
  34. If Logfile <> '' Then Do
  35.    Call Delete_File Logfile
  36.    msgdata = 'RPLMIG21 ' || message.2 || Date('U')  Time()
  37.    Call Lineout Logfile, msgdata
  38.    If result <> 0 Then Do
  39.       Say errprefix || message.3 || Logfile
  40.       exit 4
  41.    end
  42.    Call Lineout Logfile, ' '
  43. end
  44.  
  45. Call Determine_Boot_Drive
  46. If result <> 0 Then Call Error_Exit
  47.  
  48. Call Determine_RIPL_Directory
  49. If result <> 0 Then Call Error_Exit
  50.  
  51. Call Determine_LAN_Server_Version
  52. If result <> 0 Then Call Error_Exit
  53.  
  54. /* verify OS/2 2.1 is installed in RIPL tree */
  55. syslevel = '\OS2\INSTALL\SYSLEVEL.OS2'
  56. If File_Exist(rpldir'\OS2.21'syslevel) = 0 Then Do
  57.    /* OS/2 2.1 is not installed in RIPL tree */
  58.    Call Display_Log_Msg errprefix || message.14, ''
  59.    Call Error_Exit
  60. end
  61.  
  62. /* check to see if 2.1 migration has alread been run. */
  63. filename = rpldir'\RPLMIG21.$$$'
  64. If File_Exist(filename) <>  0 Then Do
  65.    /* RPLMIG21 has already been run, rerun? */
  66.    Call Display_Log_Msg message.24, ''
  67.    Pull dummy
  68.    dummy = translate(dummy)
  69.    If dummy = noresponse Then return
  70.    else Do
  71.       '@attrib -r ' filename
  72.       Call Delete_File filename
  73.    end
  74. end
  75.  
  76. /* create DEFALT2A directories/files */
  77. Call Create_DEFALT2A
  78. If result <> 0 Then return 4
  79. Call Display_Log_Msg message.22, ''
  80.  
  81. /* create DEFALT21 subdirectories */
  82. Call Create_DEFALT21_Directories
  83.  
  84. /* copy new/changed RIPL files */
  85. Call Copy_RIPL_Files
  86. If result <> 0 Then Call Error_Exit
  87.  
  88. /* update server name references in new DEFALT21.FIT */
  89. Call Update_DEFALT21_FIT
  90. If result <> 0 Then Do
  91.    Call Display_Log_Msg errprefix || message.8, ''
  92.    Call Error_Exit
  93. end
  94. else Call Display_Log_Msg message.17, ''
  95.  
  96. If LS_version = 2 Then Do
  97.    /* new SYSTEM.INI and PROGMAN.INI default boot drive id to Z: */
  98.    /* for LS 2.0, this must be changed back to C: */
  99.    Call Update_SYSTEM_INI
  100.    Call Update_bootdrv_references 'Z', 'C', 'PROGMAN.INI'
  101. end
  102.  
  103. If LS_version = 3 Then Do
  104.    /* update boot drive references in ATM.INI and MSD.INI to be Z: */
  105.    Call Update_bootdrv_references 'C', 'Z', 'ATM.INI'
  106.    Call Update_bootdrv_references 'C', 'Z', 'MSD.INI'
  107. end
  108.  
  109. /* copy *.INI and *.GRP files to DEFALT21 tree */
  110. fpath = rpldir'\OS2.21\OS2\MDOS\WINOS2\'
  111. srcfile2 = fpath || '*.INI'
  112. trg2 = lanpath'\RPLUSER\DEFALT21\OS2\MDOS\WINOS2\'
  113. Call Display_Log_Msg message.18, srcfile2, trg2
  114. '@XCOPY 'srcfile2 trg2 nulsufix
  115. srcfile2 = fpath || '*.GRP'
  116. Call Display_Log_Msg message.18, srcfile2, trg2
  117. '@XCOPY 'srcfile2 trg2 nulsufix
  118.  
  119.  
  120. /* update the RPL.MAP file to add server records for 2.1 and verify */
  121. /* field 12 of workstation record is valid */
  122. Call Update_RPL_MAP
  123. Call Display_Log_Msg message.15, ''
  124.  
  125. /* create the os221*.cnf files */
  126. Call Create_os221_cnf_files
  127. Call Display_Log_Msg message.16, ''
  128.  
  129. /* update master CONFIGRI.20 files */
  130. Call Update_Master_Configri_20
  131. Call Display_Log_Msg message.21, ''
  132.  
  133. If displaywarningmsgflag = 1 Then Do
  134.    /* default INI files do not exist, display warning */
  135.    Call Display_Log_Msg ' ', ''
  136.    Call Display_Log_Msg warnprefix || message.23, srcfile2, trg2
  137.    Call Display_Log_Msg ' ', ''
  138. end
  139.  
  140. /* create special migration file to indicate that migration is complete */
  141. /* migration file is marked READ-ONLY */
  142. rplm21 = rpldir'\RPLMIG21.$$$'
  143. Call lineout rplm21, message.15
  144. Call lineout rplm21, message.16
  145. Call lineout rplm21
  146. '@attrib +r 'rplm21 '1>nul'
  147.  
  148. If Logfile <> '' Then Do
  149.    Call Lineout Logfile
  150. end
  151. exit 0
  152.  
  153.  
  154. /* start of subroutines */
  155. /* This subroutine handles the error exit cleanup. */
  156. Error_Exit:
  157.    If Logfile <> '' Then Do
  158.       Call Lineout Logfile
  159.    end
  160.    exit 4
  161.  
  162.  
  163. /* subroutine to test for existance of a file */
  164. File_Exist:
  165.    Arg testfilename
  166.    If stream(testfilename, C, 'query exists') <> '' Then rc = 1
  167.    else rc = 0
  168.    return rc
  169.  
  170.  
  171.  
  172. /* subroutine to delete a file */
  173. Delete_File:
  174.    arg delfilename
  175.    If stream(delfilename, C, 'query exists') <> '' Then Do
  176.       '@DEL 'delfilename
  177.    end
  178.    return 0
  179.  
  180.  
  181.  
  182.  
  183. /* subroutine to display/log messages */
  184. /* This routine attempts to format the message line based on format */
  185. /* controls imbedded in each line. */
  186. Display_Log_Msg:
  187.    Parse Arg msgstring, parm.1, parm.2, parm.3, parm.4, parm.5, parm.6
  188.    if parm.1 <> '' Then Do
  189.       /* substitution data supplied */
  190.       startpoint = 1
  191.       newmsg = ''
  192.       sdpos = pos('%', msgstring, startpoint)
  193.       Do while sdpos <> 0
  194.          j = substr(msgstring, sdpos+1, 1)
  195.          newmsg = newmsg || substr(msgstring, startpoint, sdpos-startpoint) || parm.j
  196.          startpoint = sdpos+2
  197.          sdpos = pos('%', msgstring, startpoint)
  198.       end
  199.       newmsg = newmsg || substr(msgstring, startpoint)
  200.       msgstring = newmsg
  201.    end
  202.  
  203.    If substr(msgstring, 1, length(errprefix)) = errprefix Then errprefixflag = 1
  204.    else errprefixflag = 0
  205.  
  206.    If substr(msgstring, 1, length(warnprefix)) = warnprefix Then warnprefixflag = 1
  207.    else warnprefixflag = 0
  208.  
  209.    /* display/log message 1 line at a time, max line length is 75 characters */
  210.    dataflag = 1
  211.    msgline = ''
  212.    tablength = 0
  213.    indentlength = 0
  214.    indentvalue = 0
  215.    Do while dataflag = 1
  216.       /* look for special formatting commands at start of line */
  217.       do formati = 1 to 2
  218.          testword = word(msgstring, 1)
  219.          If substr(testword, 1, 2) = '%T' Then Do
  220.             /* special tab command at start of line */
  221.             tablength = substr(testword, 3)
  222.             indentvalue = 0
  223.             /* remove tab command from line */
  224.             tabp = pos('%T', msgstring)
  225.             msgstring = strip(substr(msgstring, tabp+length(testword)+1), 'L')
  226.          end
  227.          else Do
  228.             If substr(testword, 1, 2) = '%I' Then Do
  229.                /* special indent command at start of line */
  230.                indentlength = substr(testword, 3)
  231.                /* remove indent command from line */
  232.                tabp = pos('%I', msgstring)
  233.                msgstring = strip(substr(msgstring, tabp+length(testword)+1), 'L')
  234.             end
  235.             else Leave
  236.          end
  237.       end
  238.  
  239.       startscanpos = 75 - tablength - indentvalue
  240.       lenmsgstring = length(msgstring)
  241.       If lenmsgstring <> 0 Then Do
  242.          If lenmsgstring > startscanpos Then Do
  243.             /* check for CRLF in string */
  244.             crlfp = pos(CRLF, msgstring)
  245.             If crlfp <> 0 Then Do
  246.                If crlfp <= startscanpos Then Do
  247.                   If crlfp <> 1 Then Do
  248.                      /* force end of line at CRLF and discard CRLF */
  249.                      msgline = msgline || substr(msgstring, 1, crlfp-1)
  250.                      msgstring = strip(substr(msgstring, crlfp+2), 'L')
  251.                   end
  252.                end
  253.                else crlfp = 0
  254.             end
  255.  
  256.             If crlfp = 0 Then Do
  257.                /* find last blank prior to startscanpos */
  258.                endline = lastpos(' ', msgstring, startscanpos)
  259.                If endline > 0  Then Do
  260.                   msgline = msgline || substr(msgstring, 1, endline)
  261.                   msgstring = substr(msgstring, endline+1)
  262.                   If substr(msgstring, 1, 2) = CRLF Then Do
  263.                      /* special case, this CRLF can be ignored */
  264.                      msgstring = strip(substr(msgstring, 3), 'L')
  265.                   end
  266.                end
  267.                else Do
  268.                   /* no space, break word */
  269.                   msgline = substr(msgstring, 1, startscanpos)
  270.                   msgstring = substr(msgstring, startscanpos+1)
  271.                end
  272.             end
  273.          end
  274.          else Do
  275.             /* line less than max length allowed */
  276.             crlfp = pos(CRLF, msgstring)
  277.             If crlfp <> 0 Then Do
  278.                /* get message up to CRLF, discard CRLF */
  279.                msgline = substr(msgstring, 1, crlfp-1)
  280.                msgstring = substr(msgstring, crlfp+2)
  281.             end
  282.             else Do
  283.                /* only thing left if message */
  284.                msgline = msgline || msgstring
  285.                msgstring = ''
  286.             end
  287.          end
  288.  
  289.          If tablength <> 0 Then Do
  290.             /* insert required number of spaces at start of line */
  291.             msgline = copies(' ',tablength) || msgline
  292.          end
  293.          If indentvalue <> 0 Then Do
  294.             /* add in indentation value blanks */
  295.             msgline = copies(' ', indentvalue) || msgline
  296.          end
  297.  
  298.          If Logfile = '' Then Do
  299.             /* display message locally */
  300.             Say msgline
  301.             If syntaxhelpflag = 1 Then Do
  302.                nummsglines = nummsglines + 1
  303.                If nummsglines >= maxmsglines Then Do
  304.                   /* prompt user to press Enter to see next part of message */
  305.                   Say message.22
  306.                   Pull dummy .
  307.                   /* clear screen */
  308.                   'CLS'
  309.                   Say '  '         /* dummy first line */
  310.                   /* redisplay last line of last screen */
  311.                   Say msgline
  312.                   nummsglines = 2
  313.                end
  314.             end
  315.             If indentlength <> 0 Then Do
  316.                indentvalue = indentlength
  317.                indentlength = 0
  318.             end
  319.          end
  320.          else Do
  321.             /* log message */
  322.             Call lineout Logfile, msgline
  323.             nummsglines = nummsglines+1
  324.          end
  325.  
  326.          msgline = ''
  327.          If length(msgstring) = 0 Then dataflag = 0
  328.          else Do
  329.             /* if errprefix present, insert blanks at start of next msg line */
  330.             If errprefixflag = 1 then msgline = copies(' ', length(errprefix))
  331.             If warnprefixflag = 1 then msgline = copies(' ', length(warnprefix))
  332.          end
  333.       end
  334.       else dataflag = 0
  335.    end
  336.    return 0
  337.  
  338.  
  339. Determine_Installed_OS2_Levels:
  340.    syslevel = '\OS2\INSTALL\SYSLEVEL.OS2'
  341.    If File_Exist(rpldir'\OS2'syslevel) = 1 Then os213 = 1
  342.    else os213 = 0
  343.  
  344.    If File_Exist(rpldir'\OS2.20'syslevel) = 1 Then os220 = 1
  345.    else os220 = 0
  346.  
  347.    If File_Exist(rpldir'\OS2.20a'syslevel) = 1 Then os220a = 1
  348.    else os220a = 0
  349.  
  350.    If File_Exist(rpldir'\OS2.21'syslevel) = 1 Then os221 = 1
  351.    else os221 = 0
  352.    return
  353.  
  354.  
  355.  
  356. /* This subroutine determines the version of LAN Server installed on  */
  357. /* the Remote IPL server. */
  358. Determine_LAN_Server_Version:
  359.    /* Read the first 60 bytes of SYSLEVEL.SRV and check the current server */
  360.    /* level.  */
  361.    filename = lanpath'\SYSLEVEL.SRV'
  362.    syslevel = ''
  363.    /* read syslevel file, try to get it with a single linein call */
  364.    syslevel = Linein(filename)
  365.    Call Lineout filename   /* close file */
  366.    If Length(syslevel) < 60 Then Do
  367.       /* single linein did not get enought of file, get syslevel */
  368.       /* character at a time */
  369.       Do i = 1 to 60
  370.          syslevel = syslevel || charin(filename)
  371.       end
  372.       Call Charout filename
  373.    end
  374.  
  375.    /* get current csdlevel */
  376.    verp = pos('IP', syslevel)
  377.    csdlevel = substr(syslevel, verp, 8)
  378.    If verp <> 0 Then Do
  379.       /* recognize any level of LS 2.0 but only recognize initial release */
  380.       /* of LS 3.0 */
  381.       If substr(csdlevel, 4, 1) = '6' Then LS_version = 2
  382.       else If substr(csdlevel, 4, 1) = '7' Then Do
  383.               If substr(csdlevel, 5, 3) = '000' Then LS_version = 3
  384.               else LS_version = '3x'
  385.            end
  386.            else LS_version = ''
  387.    end
  388.    If LS_version = '' Then Do
  389.       /* not LS 2.0 or LS 3.x */
  390.       msgdata = errprefix || message.11
  391.       Call Display_Log_Msg msgdata, csdlevel
  392.       return 4
  393.    end
  394.    else If LS_version = '3x' Then Do
  395.         /* not initial LS 3.0 release */
  396.         msgdata = errprefix || message.12
  397.         Call Display_Log_Msg msgdata, csdlevel
  398.         return 4
  399.    end
  400.    return 0
  401.  
  402.  
  403.  
  404.  
  405. /* create new subdirectories for DEFALT21 */
  406. Create_DEFALT21_Directories:
  407.    Call Display_Log_Msg message.20, ''
  408.    rplpath = rpldir'\MACHINES\DEFALT21'
  409.    /* create MACHINES\DEFALT21 tree */
  410.    '@MD ' rplpath nulsufix
  411.    '@MD ' rplpath || '\IBMLAN' nulsufix
  412.  
  413.    /* create \IBMLAN\RPLUSER\DEFALT21 tree */
  414.    rupath = lanpath'\RPLUSER\DEFALT21'
  415.    '@MD 'rupath nulsufix
  416.    '@MD 'rupath || '\IBMLAN' nulsufix
  417.    '@MD 'rupath || '\IBMLAN\LOGS' nulsufix
  418.    '@MD 'rupath || '\IBMLAN\PROFILES' nulsufix
  419.    '@MD 'rupath || '\IBMLAN\ACCOUNTS' nulsufix
  420.    '@MD 'rupath || '\IBMCOM' nulsufix
  421.    '@MD 'rupath || '\SPOOL' nulsufix
  422.    '@MD 'rupath || '\OS2' nulsufix
  423.    '@MD 'rupath || '\OS2\MDOS' nulsufix
  424.    '@MD 'rupath || '\OS2\MDOS\WINOS2' nulsufix
  425.    '@MD 'rupath || '\OS2\SYSTEM' nulsufix
  426.    return 0
  427.  
  428.  
  429.  
  430. /* copy new/updated RIPL files to server */
  431. Copy_RIPL_Files:
  432.    /* copy files to DEFALT21 tree */
  433.    defalt2x = 'DEFALT21'
  434.    /* copy requester IBMLAN.INI to DEFALT2x tree */
  435.    srcfile = rpldir'\MACHINES\DEFALT20\IBMLAN\IBMLAN.INI'
  436.    trg = rpldir'\MACHINES\' || defalt2x || '\IBMLAN\'
  437.    Call Display_Log_Msg message.18, srcfile, trg
  438.    '@COPY 'srcfile trg nulsufix
  439.    If rc = 0 Then Do
  440.  
  441.       rplupath = lanpath || '\RPLUSER\'
  442.  
  443.       /* copy NET.ACC from DEFALT20 to DEFALT21 */
  444.       srcfile = rplupath || 'DEFALT20\IBMLAN\ACCOUNTS\NET.ACC'
  445.       trg = rplupath || defalt2x || '\IBMLAN\ACCOUNTS\'
  446.       Call Display_Log_Msg message.18, srcfile, trg
  447.       '@COPY 'srcfile trg nulsufix
  448.       If rc = 0 Then Do
  449.  
  450.          /* copy AUTOEXEC.20 from DEFALT20 TO DEFALT21 */
  451.          srcfile = rplupath || 'DEFALT20\AUTOEXEC.20'
  452.          trg = rplupath || defalt2x
  453.           Call Display_Log_Msg message.18, srcfile, trg
  454.          '@COPY 'srcfile trg nulsufix
  455.       end
  456.    end
  457.    If rc <> 0 Then Do
  458.       Call Display_Log_Msg errprefix || message.9, srcfile, trg
  459.       return 4
  460.    end
  461.  
  462.    /* start processing new files */
  463.    /* rename old RPLSETD.CMD, if it exists */
  464.    If File_Exist(rpldir'\RPLSETD.CMD') = 1 Then Do
  465.       /* rename old version of RPLSETD.CMD in RPL directory */
  466.       '@RENAME 'rpldir'\RPLSETD.CMD  RPLSETD.OLD' nulsufix
  467.    end
  468.  
  469.    /* unzip common RPL*.* files to \IBMLAN\NETPROG */
  470.    trg = lanpath'\NETPROG\'
  471.    srcfile = SourcePath'IBMLS.ZIP'
  472.    srcfile2 = srcfile || '\RPL*.*'
  473.    Call Display_Log_Msg message.19, srcfile2, trg
  474.    '@'lanpath'\INSTALL\PKUNZIP2 -o 'srcfile trg 'RPL*.*' nulsufix
  475.    If rc <> 0 Then Do
  476.       Call Display_Log_Msg errprefix || message.10, srcfile2, trg
  477.       return 4
  478.    end
  479.  
  480.    /* unzip dummy \IBMLAN\RPL\RPLSETD.CMD */
  481.    trg = lanpath'\RPL\'
  482.    srcfile = SourcePath'IBMLS.ZIP'
  483.    srcfile2 = srcfile || '\DRPLSETD.CMD'
  484.    Call Display_Log_Msg message.19, srcfile2, trg
  485.    '@'lanpath'\INSTALL\PKUNZIP2 -o 'srcfile trg 'DRPLSETD.CMD' nulsufix
  486.    If rc <> 0 Then Do
  487.       Call Display_Log_Msg errprefix || message.10, srcfile2, trg
  488.       return 4
  489.    end
  490.    /* rename DRPLSETD.CMD to RPLSETD.CMD */
  491.    '@RENAME 'rpldir'\DRPLSETD.CMD  RPLSETD.CMD' nulsufix
  492.  
  493.    /* copy new DEFALT21.FIT */
  494.    trg = rpldir'\FITS\'
  495.    srcfile2 = srcfile || '\DEFALT21.FIT'
  496.    Call Display_Log_Msg message.19, srcfile2 , trg
  497.    '@'lanpath'\INSTALL\PKUNZIP2 -o 'srcfile trg 'DEFALT21.FIT' nulsufix
  498.    If rc <> 0 Then Do
  499.       Call Display_Log_Msg errprefix || message.10, srcfile2, trg
  500.       return 4
  501.    end
  502.  
  503.    /* PROGMAN.INI, if necessary, backup old file */
  504.    fpath = rpldir'\OS2.21\OS2\MDOS\WINOS2\'
  505.    srcfile2 = fpath || 'PROGMAN.INI'
  506.    trg2 = fpath || 'PROGMAN.IN_'
  507.    If File_Exist(trg2) = 0 Then '@COPY 'srcfile2 trg2 nulsufix
  508.  
  509.    /* SYSTEM.INI, if necessary, backup old file */
  510.    srcfile2 = fpath || 'SYSTEM.INI'
  511.    trg2 = fpath || 'SYSTEM.IN_'
  512.    If File_Exist(trg2) = 0 Then '@COPY 'srcfile2 trg2 nulsufix
  513.  
  514.    /* copy new WINOS2 support files */
  515.    trg = fpath
  516.    srcfile2 = srcfile || '\*.INI'
  517.    Call Display_Log_Msg message.19, srcfile2, trg
  518.    '@'lanpath'\INSTALL\PKUNZIP2 -o 'srcfile trg '*.INI' nulsufix
  519.    If rc <> 0 Then Do
  520.       Call Display_Log_Msg errprefix || message.10, srcfile2, trg
  521.       return 4
  522.    end
  523.  
  524.    /* copy default client INI files to DEFALT21 tree */
  525.    fpath = rpldir'\OS2.21\OS2\'
  526.    srcfile2 = fpath || 'RPOS2TMP.INI'
  527.    trg2 = lanpath'\RPLUSER\DEFALT21\OS2\OS2INI.20'
  528.    If File_Exist(srcfile2) Then Do
  529.       /* copy RPOS2TMP.INI to OS2INI.20 */
  530.       Call Display_Log_Msg message.18, srcfile2, trg2
  531.       '@COPY 'srcfile2 trg2 nulsufix
  532.       If rc = 0 Then Do
  533.          /* copy RPOS2SYS.INI to OS2SYINI.20 */
  534.          srcfile2 = fpath || 'RPOS2SYS.INI'
  535.          trg2 = lanpath'\RPLUSER\DEFALT21\OS2\OS2SYINI.20'
  536.          Call Display_Log_Msg message.18, srcfile2, trg2
  537.          '@COPY 'srcfile2 trg2 nulsufix
  538.       end
  539.       If rc <> 0 Then Do
  540.          Call Display_Log_Msg errprefix || message.9, srcfile2, trg2
  541.          return 4
  542.       end
  543.    end
  544.    else Do
  545.       /* default INI files do not exist, set flag to display warning at exit */
  546.       displaywarningmsgflag = 1
  547.    end
  548.  
  549.  
  550.    /* unzip version EXE files, build source path based on version */
  551.    srcfile = SourcePath'IBMLS'
  552.    If LS_version = 2 Then srcfile = srcfile || '20.ZIP'
  553.    else srcfile = srcfile ||'30.ZIP'
  554.  
  555.    /* if necessary, backup old files common to LS 2.0 and 3.0 */
  556.    backuplst.0 = 2
  557.    backuplst.1 = 'RMM1.EXE'
  558.    backuplst.2 = 'GETRPL.EXE'
  559.    do i = 1 to backuplst.0
  560.       srcfile2 = lanpath'\NETPROG\' || backuplst.i
  561.       trg2 = substr(srcfile2, 1 , length(srcfile2)-1) || '_'
  562.       If File_Exist(trg2) = 0 Then '@COPY 'srcfile2 trg2 nulsufix
  563.    end
  564.  
  565.    /* unzip *.EXE files */
  566.    trg = lanpath'\NETPROG\'
  567.    srcfile2 = srcfile || '\*.EXE'
  568.    Call Display_Log_Msg message.19, srcfile2 , trg
  569.    '@'lanpath'\INSTALL\PKUNZIP2 -o 'srcfile trg '*.EXE' nulsufix
  570.    If rc <> 0 Then Do
  571.       Call Display_Log_Msg errprefix || message.10, srcfile2, trg
  572.       return 4
  573.    end
  574.  
  575.  
  576.    /* process version unique files */
  577.    If LS_version = 2 Then Do
  578.       /* LAN Server version is 2.0 */
  579.       srcfile = SourcePath'IBMLS20.ZIP'
  580.       If substr(csdlevel, 4, 4) = '6000' Then Do
  581.          /* NETWKSTA.200 and MFSD20.SYS must be replace for level 6000 */
  582.          /* NETWKSTA.200, if necessary, backup old file */
  583.          srcfile2 = lanpath'\NETPROG\NETWKSTA.200'
  584.          trg2 = substr(srcfile2, 1, length(srcfile2)-1) || '_'
  585.          If File_Exist(trg2) = 0 Then '@COPY 'srcfile2 trg2 nulsufix
  586.  
  587.          /* unzip NETWKSTA.200 */
  588.          trg = lanpath'\NETPROG\'
  589.          srcfile2 = srcfile || '\NETWKSTA.200'
  590.          Call Display_Log_Msg message.19, srcfile2 , trg
  591.          '@'lanpath'\INSTALL\PKUNZIP2 -o 'srcfile trg 'NETWKSTA.200' nulsufix
  592.          If rc <> 0 Then Do
  593.             Call Display_Log_Msg errprefix || message.10, srcfile2, trg
  594.             return 4
  595.          end
  596.          /* copy to RPL tree */
  597.          srcfile2 = rpldir'\IBMLAN\NETPROG\NETWKSTA.200'
  598.          trg2 = substr(srcfile2, 1, length(srcfile2)-1) || '_'
  599.          If File_Exist(trg2) = 0 Then '@COPY 'srcfile2 trg2 nulsufix
  600.          srcfile2 = lanpath'\NETPROG\NETWKSTA.200'
  601.          trg2 = rpldir'\IBMLAN\NETPROG\'
  602.          Call Display_Log_Msg message.18, srcfile2, trg2
  603.          '@COPY 'srcfile2 trg2 nulsufix
  604.  
  605.          /* MFSD20.SYS, if necessary, backup old file */
  606.          srcfile2 = rpldir'\OS2\MFSD20.SYS'
  607.          trg2 = substr(srcfile2, 1, length(srcfile2)-1) || '_'
  608.          If File_Exist(trg2) = 0 Then '@COPY 'srcfile2 trg2 nulsufix
  609.  
  610.          /* unzip MFSD20.SYS, note different directory from LS 3.0 */
  611.          trg = rpldir'\OS2\'
  612.          srcfile2 = srcfile || '\MFSD20.SYS'
  613.          Call Display_Log_Msg message.19, srcfile2 , trg
  614.          '@'lanpath'\INSTALL\PKUNZIP2 -o 'srcfile trg 'MFSD20.SYS' nulsufix
  615.          If rc <> 0 Then Do
  616.             Call Display_Log_Msg errprefix || message.10, srcfile2, trg
  617.             return 4
  618.          end
  619.       end
  620.    end
  621.    else Do
  622.       /* LAN Server version is 3.0 */
  623.       srcfile = SourcePath'IBMLS30.ZIP'
  624.       /* MFSD20.SYS, if necessary, backup old file */
  625.       srcfile2 = rpldir'\DOS\MFSD20.SYS'
  626.       trg2 = rpldir'\DOS\MFSD20.SY_'
  627.       If File_Exist(trg2) = 0 Then '@COPY 'srcfile2 trg2 nulsufix
  628.  
  629.       /* unzip MFSD20.SYS, note different directory from LS 2.0 */
  630.       trg = rpldir'\DOS\'
  631.       srcfile2 = srcfile || '\MFSD20.SYS'
  632.       Call Display_Log_Msg message.19, srcfile2, trg
  633.       '@'lanpath'\INSTALL\PKUNZIP2 -o 'srcfile trg 'MFSD20.SYS' nulsufix
  634.       If rc <> 0 Then Do
  635.          Call Display_Log_Msg errprefix || message.10, srcfile2, trg
  636.          return 4
  637.       end
  638.  
  639.       /* RMM1PANA.LIB, if necessary, backup old file */
  640.       srcfile2 = lanpath'\NETPROG\RMM1PANA.LIB'
  641.       trg2 = substr(srcfile2, 1 , length(srcfile2)-1) || '_'
  642.       If File_Exist(trg2) = 0 Then '@COPY 'srcfile2 trg2 nulsufix
  643.  
  644.       /* unzip RMM1PANA.LIB */
  645.       trg = lanpath'\NETPROG\'
  646.       srcfile2 = srcfile || '\RMM1PANA.LIB'
  647.       Call Display_Log_Msg message.19, srcfile2, trg
  648.       '@'lanpath'\INSTALL\PKUNZIP2 -o 'srcfile trg 'RMM1PANA.LIB' nulsufix
  649.       If rc <> 0 Then Do
  650.          Call Display_Log_Msg errprefix || message.10, srcfile2, trg
  651.          return 4
  652.       end
  653.    end
  654.  
  655.  
  656.  
  657.  
  658. /* subroutine updates all the server name references in the DEFALT21.FIT, */
  659. /* If LS 2.0 changes Z: references to C: */
  660. Update_DEFALT21_FIT:
  661.    /* get server name from first record in DEFALT20.FIT */
  662.    fit20 = rpldir'\FITS\DEFALT20.FIT'
  663.    data = linein(fit20)
  664.    Call stream fit20,C,'close'
  665.    spos = pos('\', data, 3)
  666.    If spos <> 0 Then servername = substr(data, 3, spos-3)
  667.    else Do
  668.       /* error */
  669.       Call Display_Log_Msg errprefix || message.7, ''
  670.       return 4
  671.    end
  672.  
  673.    /* read each DEFALT21.FIT record and update server name references */
  674.    fit21 = rpldir'\FITS\DEFALT21.FIT'
  675.    tmpfit21 = rpldir'\FITS\DEFALT21.TMP'
  676.    do until lines(fit21) = 0
  677.       data = linein(fit21)
  678.       ucdata = translate(data)
  679.       serverp = pos('\\SERVER\', ucdata)
  680.       if serverp <> 0 Then Do
  681.          /* replace with real server name */
  682.          newdata = substr(data, 1, serverp+1)||servername||,
  683.                    substr(data, serverp+8)
  684.          data = newdata
  685.       end
  686.  
  687.       If LS_version = 2 Then Do
  688.          /* check for Z:\ references */
  689.          bootdrvp = pos('Z:\', ucdata)
  690.          If bootdrvp <> 0 Then Do
  691.             /* change Z:\ references to C:\ references */
  692.             If bootdrvp = 1 Then newdata = 'C' || substr(data, 2)
  693.             else newdata = substr(data, 1, bootdrvp-1) || 'C' ||,
  694.                            substr(data, bootdrvp+1)
  695.             data = newdata
  696.          end
  697.       end
  698.       Call lineout tmpfit21, data
  699.    end
  700.    Call lineout tmpfit21
  701.    Call lineout fit21
  702.    '@RENAME 'fit21 ' DEFALT21.BAK' nulsufix
  703.    '@RENAME 'tmpfit21 ' DEFALT21.FIT' nulsufix
  704.    Call Delete_File rpldir'\FITS\DEFALT21.BAK'
  705.    return 0
  706.  
  707.  
  708. /* subroutine to update boot drive references to C: and D: */
  709. Update_SYSTEM_INI:
  710.    fpath = rpldir'\OS2.21\OS2\MDOS\WINOS2\'
  711.    srcfile = fpath || 'SYSTEM.INI'
  712.    trgfile = fpath || 'SYSTEM.TMP'
  713.    Call Delete_File trgfile
  714.    Call Delete_File fpath || 'SYSTEM.BAK'
  715.    count = 1
  716.  
  717.    /* update Pagingfile= records, they are the only records with boot */
  718.    /* drive references in them */
  719.    Do while lines(srcfile) <> 0
  720.       data = linein(srcfile)
  721.       ucdata = translate(data)
  722.       dpos = pos('PAGINGFILE=', ucdata)
  723.       If dpos <> 0 Then Do
  724.          /* record found */
  725.          newdata = substr(data, 1, dpos+10)
  726.          If count = 1 Then Do
  727.             /* first record is for local drive which will be D */
  728.             newdata = newdata || 'D'
  729.             count = 2
  730.          end
  731.          else Do
  732.             /* second record is for RIPL server which will be C */
  733.             newdata = newdata || 'C'
  734.          end
  735.          dpos = pos(':', data)
  736.          If dpos <> 0 Then newdata = newdata || substr(data, dpos)
  737.          else newdata = newdata || ':\WIN386.SWP'
  738.          data = newdata
  739.       end
  740.       Call Lineout trgfile, data
  741.    end
  742.  
  743.    /* close files */
  744.    Call Lineout srcfile
  745.    Call Lineout trgfile
  746.  
  747.    /* rename files */
  748.    '@RENAME ' srcfile ' SYSTEM.BAK 'nulsufix
  749.    '@RENAME ' trgfile ' SYSTEM.INI 'nulsufix
  750.    Call Delete_File fpath || 'SYSTEM.BAK'
  751.  
  752.    return
  753.  
  754.  
  755. /* subroutine to update boot drive references in a file */
  756. Update_bootdrv_references:
  757.    parse arg oldbootdrv, newbootdrv, filename
  758.  
  759.    fpath = rpldir'\OS2.21\OS2\MDOS\WINOS2\'
  760.    srcfile = fpath || filename
  761.    fname = substr(filename, 1, length(filename)-3)
  762.    trgfile = fpath || fname || 'TMP'
  763.    Call Delete_File trgfile
  764.    Call Delete_File fpath || fname || 'BAK'
  765.  
  766.    /* locate any old boot drive references and change them to new boot */
  767.    /* drive references */
  768.    Do while lines(srcfile) <> 0
  769.       data = linein(srcfile)
  770.       ucdata = translate(data)
  771.       dpos = pos(oldbootdrv || ':\', ucdata)
  772.       If dpos <> 0 Then Do
  773.          newdata = substr(data, 1, dpos-1) || newbootdrv ||,
  774.                    substr(data, dpos+1)
  775.          data = newdata
  776.       end
  777.       Call Lineout trgfile, data
  778.    end
  779.  
  780.    /* close files */
  781.    Call Lineout srcfile
  782.    Call Lineout trgfile
  783.  
  784.    /* rename files */
  785.    '@RENAME ' srcfile  fname || 'BAK ' nulsufix
  786.    '@RENAME ' trgfile  filename  nulsufix
  787.    Call Delete_File fpath || fname || 'BAK'
  788.  
  789.    return
  790.  
  791.  
  792.  
  793. /* this subroutine creates the DEFALT2A directories and files from DEFALT20 */
  794. Create_DEFALT2A:
  795.    /* create MACHINES\DEFALT2A */
  796.    srcfile = rpldir'\MACHINES\DEFALT20\*.*'
  797.    trg = rpldir'\MACHINES\DEFALT2A\'
  798.    Call Display_Log_Msg message.18, srcfile, trg
  799.    '@XCOPY 'srcfile trg '/E /S' nulsufix
  800.    If rc = 0 Then Do
  801.       /* create RPLUSER\DEFALT2A */
  802.       srcfile = lanpath'\RPLUSER\DEFALT20\*.*'
  803.       trg = lanpath'\RPLUSER\DEFALT2A\'
  804.       Call Display_Log_Msg message.18, srcfile, trg
  805.       '@XCOPY 'srcfile trg '/E /S' nulsufix
  806.    end
  807.    If rc <> 0 Then Do
  808.       Call Display_Log_Msg errprefix || message.9, srcfile, trg
  809.       return 4
  810.    end
  811.  
  812.    /* backup existing file and delete original */
  813.    fit20 = rpldir'\FITS\DEFALT20.FIT'
  814.    fit2A = rpldir'\FITS\DEFALT2A.FIT'
  815.    If File_Exist(fit2A) Then Do
  816.       /* backup existing file */
  817.       '@COPY 'fit2A substr(fit2A, 1, length(fit2A)-3) || 'BAK' nulsufix
  818.       /* delete file */
  819.       Call Delete_File fit2A
  820.    end
  821.  
  822.    /* read each DEFALT20.FIT record, update DEFALT20 and OS2.20 references, */
  823.    /* and copy to DEFALT2A.FIT */
  824.    do until lines(fit20) = 0
  825.       data = linein(fit20)
  826.       ucdata = translate(data)
  827.       defalt20p = pos('DEFALT20', ucdata)
  828.       if defalt20p <> 0 Then Do
  829.          /* replace with DEFALT2A */
  830.          newdata = substr(data, 1, defalt20p-1)||'DEFALT2A'||,
  831.                    substr(data, defalt20p+8)
  832.          data = newdata
  833.       end
  834.       os220p = pos('OS2.20\', ucdata)
  835.       if os220p <> 0 Then Do
  836.          /* replace OS2.20 with OS2.20a */
  837.          newdata = substr(data, 1, os220p+5) || 'a' ||,
  838.                    substr(data, os220p+6)
  839.          data = newdata
  840.       end
  841.       Call lineout fit2A, data
  842.    end
  843.    Call lineout fit2A
  844.    Call lineout fit20
  845.    return 0
  846.  
  847.  
  848. /* This subroutine updates RPL.MAP to support OS/2 2.1 server records */
  849. Update_RPL_MAP:
  850.    Call Determine_Installed_OS2_Levels
  851.    rplmap = rpldir'\RPL.MAP'
  852.    rplmaptmp = rpldir'\RPLMAP.TMP'
  853.    Call Delete_File rplmaptmp
  854.    i = 1
  855.    os221flag = 0
  856.    srvrec.0 = 0
  857.    do until lines(rplmap) = 0
  858.       data = linein(rplmap)
  859.       ucdata = translate(data)
  860.       psrv = pos('YYYYYYYYYYYY', ucdata)
  861.       if psrv <> 0 & psrv < 3 Then Do
  862.          /* server record, check for OS/2 type */
  863.          pos2 = pos('OS2BB', ucdata)
  864.          if pos2 <> 0 Then Do
  865.             /* OS/2 1.3, determine if it should be enabled or disabled */
  866.             If os213 = 1 Then Do
  867.                /* should be enabled */
  868.                If substr(data, 1, 1) = ';' Then data = substr(data, 2)
  869.             end
  870.             else Do
  871.                /* should be disabled */
  872.                If substr(data, 1, 1) <> ';' Then data = ';'data
  873.             end
  874.          end
  875.          else Do
  876.             pos2 = pos('OS220', ucdata)
  877.             if pos2 <> 0 Then Do
  878.                /* OS/2 2.0 type, save it */
  879.                srvrec.0 = i
  880.                srvrec.i = data
  881.                i = i + 1
  882.                /* determine if it should be enabled or disabled */
  883.                If os220 = 1 Then Do
  884.                   /* should be enabled, maybe */
  885.                   If substr(data, 1, 1) = ';' Then Do
  886.                      /* enable except for 3COM entries */
  887.                      If pos('OS2203E', ucdata) = 0 Then data = substr(data, 2)
  888.                   end
  889.                end
  890.                else Do
  891.                   /* should be disabled */
  892.                   If substr(data, 1, 1) <> ';' Then data = ';'data
  893.                end
  894.             end
  895.             else Do
  896.                /* check for OS2.20a record */
  897.                pos2 = pos('OS22A', ucdata)
  898.                If pos2 <> 0 Then Do
  899.                   /* os2.20a, determine if it should be enabled or disabled */
  900.                   If os220a = 1 Then Do
  901.                      /* should be enabled, maybe */
  902.                      If substr(data, 1, 1) = ';' Then Do
  903.                         /* enable except for 3COM entries */
  904.                         If pos('OS22A3E', ucdata) = 0 Then data = substr(data, 2)
  905.                      end
  906.                   end
  907.                   else Do
  908.                      /* should be disabled */
  909.                      If substr(data, 1, 1) <> ';' Then data = ';'data
  910.                   end
  911.                end
  912.                else Do
  913.                   /* check for existing 2.1 server record */
  914.                   pos2 = pos('OS221', ucdata)
  915.                   If pos2 <> 0 Then os221flag = 1
  916.                   else Do
  917.                      /* check for last server record */
  918.                      pos2 = pos('PCINIT.CNF', ucdata)
  919.                      If pos2 <> 0 Then Do
  920.                         /* end of server records, do we need to create new records? */
  921.                         If os221flag = 0 Then Do
  922.                            If srvrec.0 <> 0 Then Do
  923.                               /* need to create OS/2 2.1 records, use saved */
  924.                               /* OS220 records as a master */
  925.                               Do j = 1 to srvrec.0
  926.                                  /* locate OS/2 cnf entry in field 2 */
  927.                                  pos2 = pos('OS220', translate(srvrec.j))
  928.                                  newdata = substr(srvrec.j, 1, pos2+3) || '1'
  929.                                  startpoint = pos2+5
  930.  
  931.                                  /* locate OS type in field 7 */
  932.                                  pos2 = pos('~2.0~', srvrec.j, startpoint)
  933.                                  If pos2 <> 0 Then Do
  934.                                     /* LS 3.0 record format */
  935.                                     newdata = newdata ||,
  936.                                     substr(srvrec.j, startpoint, (pos2+3)-startpoint)
  937.                                     newdata = newdata || '1'
  938.                                     startpoint = pos2 + 4
  939.                                  end
  940.                                  else Do
  941.                                     pos2 = pos('~20~', srvrec.j, startpoint)
  942.                                     If pos2 <> 0 Then Do
  943.                                     /* LS 2.0 record format */
  944.                                        newdata = newdata ||,
  945.                                        substr(srvrec.j, startpoint, (pos2+2)-startpoint)
  946.                                        newdata = newdata || '.1'
  947.                                        startpoint = pos2 + 3
  948.                                     end
  949.                                     else Do
  950.                                        /* type not recognized, doing nothing */
  951.                                        /* will cause existing description */
  952.                                        /* (field 7) to be used. */
  953.                                     end
  954.                                  end
  955.  
  956.                                  /* locate OS type in field 12 */
  957.                                  pos2 = pos('_20_', srvrec.j, startpoint)
  958.                                  newdata = newdata || substr(srvrec.j, startpoint, (pos2+2)-startpoint)
  959.                                  newdata = newdata || '1'
  960.                                  startpoint = pos2 + 3
  961.                                  newdata = newdata || substr(srvrec.j, startpoint)
  962.                                  if substr(newdata, 1, 1) = ';' Then Do
  963.                                     ucnewdata = translate(newdata)
  964.                                     pos2 = pos('OS221', ucnewdata)
  965.                                     adaptype = substr(ucnewdata, pos2+5, 3)
  966.                                     /* if not 3COM entry, enable record */
  967.                                     If adaptype <> '3EI' & adaptype <> '3EM' Then newdata = substr(newdata, 2)
  968.                                  end
  969.                                  Call lineout rplmaptmp, newdata
  970.                               end
  971.                            end
  972.                         end
  973.                      end
  974.                   end
  975.                end
  976.             end
  977.          end
  978.       end
  979.       else Do
  980.          pos2 = pos('1000FFFFFFFF', data)
  981.          if pos2 <> 0 Then Do
  982.             /* OS2 default workstation record, try to make sure fields 4 & 12 */
  983.             /* are valid */
  984.             field12 = word(data, 12)
  985.             pf12 = pos(field12, data)
  986.             os2type = substr(field12, 3, 2)
  987.             f12flag = 1
  988.             If os2type = '20' & os220 = 0 Then f12flag = 0
  989.             else If os2type = '2A' & os220a = 0 Then f12flag = 0
  990.                else If os2type = '21' & os221 = 0 Then fl12flag = 0
  991.                   else If substr(os2type, 1, 1) = 'O' & os213 = 0 Then fl12flag = 0
  992.             If f12flag = 0 Then Do
  993.                /* field 12 is invalid, therefore so is field 4, update */
  994.                /* them so they are valid */
  995.                If os220 = 1 Then os2type = '20'
  996.                else If os220a = 1 Then os2type = '2A'
  997.                     else If os221 = 1 Then os2type = '21'
  998.                          else os2type = '21'  /* default to 21 */
  999.                If os2type <> '' Then Do
  1000.                   field4 = word(data, 4)
  1001.                   pf4 = pos(field4, data)
  1002.                   pf4 = pf4 + length(field4) - 3
  1003.                   If os2type = '2A' Then newdata = substr(data, 1, pf4) || '20'
  1004.                   else newdata = substr(data, 1, pf4) || os2type
  1005.                   newdata = newdata || substr(data, pf4+3, pf12-pf4-1) || os2type
  1006.                   data = newdata || substr(data, pf12+4)
  1007.                end
  1008.             end
  1009.          end
  1010.       end
  1011.       Call lineout rplmaptmp, data
  1012.    end
  1013.    Call lineout rplmap
  1014.    Call lineout rplmaptmp
  1015.  
  1016.    If os221flag = 0 Then Do
  1017.       /* replace old RPL.MAP with new RPL.MAP */
  1018.       rplmapxxx = 'RPLMAP.xxx'
  1019.       Call Delete_File rpldir'\'rplmapxxx
  1020.       '@rename 'rplmap  rplmapxxx nulsufix
  1021.       '@rename 'rplmaptmp 'RPL.MAP'nulsufix
  1022.       Call Delete_File rpldir'\'rplmapxxx
  1023.    end
  1024.    else Call Delete_File rpldir'\'rplmaptmp
  1025.  
  1026.    return
  1027.  
  1028.  
  1029. /* This subroutine creates CNF file for OS/2 2.1 */
  1030. Create_os221_cnf_files:
  1031.    /* build list of possible source cnf filenames */
  1032.    cnflist.0 = 5
  1033.    cnflist.1 = 'os220tr'
  1034.    cnflist.2 = 'os220et'
  1035.    cnflist.3 = 'os220pc'
  1036.    cnflist.4 = 'os2203ei'
  1037.    cnflist.5 = 'os2203em'
  1038.  
  1039.    Do i = 1 to cnflist.0
  1040.       srccnffile = rpldir'\'cnflist.i'.cnf'
  1041.       trgcnffile = rpldir'\'substr(cnflist.i,1,4)'1'substr(cnflist.i,6)'.cnf'
  1042.       If File_Exist(srccnffile) = 1 Then Do
  1043.          /* source file exists, check target file */
  1044.          If File_Exist(trgcnffile) = 0 Then Do
  1045.             /* file does not exist, create it */
  1046.             do until lines(srccnffile) = 0
  1047.                data = linein(srccnffile)
  1048.                ucdata = translate(data)
  1049.                pos2 = pos('OS2.20\', ucdata)
  1050.                if pos2 <> 0 Then Do
  1051.                   /* update OS/2 directory reference */
  1052.                   newdata = substr(data, 1, pos2+4) || '1' || substr(data, pos2+6)
  1053.                   data = newdata
  1054.                end
  1055.                Call lineout trgcnffile, data
  1056.             end
  1057.             Call lineout srccnffile
  1058.             Call lineout trgcnffile
  1059.          end
  1060.       end
  1061.    end
  1062.    return
  1063.  
  1064.  
  1065.  
  1066. /* Subroutine Update_Master_Configri_20 */
  1067. /* This subroutine creates new master CONFIGRI.20 files that have the */
  1068. /* DRIVER=x:\OS2\TESTCFG.SYS statement added to it */
  1069. Update_Master_Configri_20:
  1070.  
  1071.    /* build list of directories in RPL\IBMCOM to process */
  1072.    lanlist.0 = 6
  1073.    lanlist.1 = 'TOKENRNG'
  1074.    lanlist.2 = 'ETHERNET'
  1075.    lanlist.3 = 'PCNETA'
  1076.    lanlist.4 = 'PCNET'
  1077.    lanlist.5 = 'ELNKII'
  1078.    lanlist.6 = 'ELNKMC'
  1079.  
  1080.    Do i = 1 to lanlist.0
  1081.       lantype = lanlist.i
  1082.       configfilename = rpldir'\IBMCOM\'lantype'\CONFIGRI.20'
  1083.       If File_Exist(configfilename) <> 0 Then Do
  1084.          /* build fully qualified path name for master CONFIGRI.20 */
  1085.          configname = rpldir'\IBMCOM\'lantype'\CONFIGRI.20'
  1086.          tmpconfigname = rpldir'\IBMCOM\'lantype'\CONFIGRI.20T'
  1087.          bakconfigname = rpldir'\IBMCOM\'lantype'\CONFIGRI.20B'
  1088.  
  1089.          /* Call SysFileDelete tmpconfigname */
  1090.          Call Delete_File tmpconfigname
  1091.          Call Delete_File bakconfigname
  1092.  
  1093.          bootdrv = 'Z'
  1094.          /* copy records looking for TESTCFG.SYS statement */
  1095.          flag = 0
  1096.          do until lines(configname) = 0
  1097.             data = linein(configname)
  1098.             ucdata = translate(data)
  1099.             dpos = pos('SET PATH=', ucdata)
  1100.             if dpos <> 0 Then Do
  1101.                /* get bootdrive id from SET PATH statement */
  1102.                dpos = pos(':\OS2;', ucdata)
  1103.                if dpos <> 0 Then bootdrv = substr(ucdata, dpos-1, 1)
  1104.             end
  1105.             dpos = pos('DEVICE=', ucdata)
  1106.             If dpos <> 0 Then Do
  1107.                If pos('\OS2\TESTCFG.SYS', ucdata, dpos+7) <> 0 Then Do
  1108.                   /* DEVICE statement already present */
  1109.                   If word(ucdata, 1) = 'REM' Then Do
  1110.                      /* statement REMed out, un-REM it */
  1111.                      newdata = substr(data, dpos)
  1112.                      data = newdata
  1113.                   end
  1114.                   flag = 1
  1115.                end
  1116.             end
  1117.             Call lineout tmpconfigname, data
  1118.          end
  1119.          If flag = 0 Then Do
  1120.             /* add DEVICE statement to end of file */
  1121.             Call lineout tmpconfigname, 'DEVICE='bootdrv':\OS2\TESTCFG.SYS'
  1122.          end
  1123.  
  1124.          Call Lineout tmpconfigname   /* close file */
  1125.          Call Lineout configname      /* close file */
  1126.  
  1127.          /* rename original CONFIGRI.20 */
  1128.          '@rename 'configname' CONFIGRI.20B'
  1129.          if rc = 0 Then Do
  1130.             /* rename CONFIGRI.20T to be CONFIGRI.20 */
  1131.             '@rename 'tmpconfigname' CONFIGRI.20'
  1132.             if rc = 0 Then Do
  1133.                /* delete orginal CONFIGRI.20 */
  1134.                Call Delete_File bakconfigname
  1135.             end
  1136.             else Do
  1137.                /* rename error, try to restore original */
  1138.                '@rename 'bakconfigname' CONFIGRI.20'
  1139.             end
  1140.          end
  1141.       end
  1142.    end
  1143.    return 0
  1144.  
  1145.  
  1146.  
  1147. Determine_Boot_Drive:
  1148.    /* find the boot driver id */
  1149.    os2path = value('PATH',,'OS2ENVIRONMENT')
  1150.  
  1151.    os2p = pos(':\OS2', translate(os2path))
  1152.    if os2p = 0 Then Do
  1153.      msgdata = errprefix || message.5
  1154.      Call Display_Log_Msg msgdata, ''
  1155.      return 4
  1156.    end
  1157.  
  1158.    bootdrv = substr(os2path, os2p-1, 1)
  1159.    return 0
  1160.  
  1161.  
  1162.  
  1163. Determine_RIPL_Directory:
  1164.    /* find out where IBMLAN is installed */
  1165.    os2path = value('PATH',,'OS2ENVIRONMENT')
  1166.  
  1167.    ibmlanp = pos(':\IBMLAN', translate(os2path))
  1168.    if ibmlanp = 0 Then Do
  1169.      msgdata = errprefix || message.6
  1170.      Call Display_Log_Msg msgdata, ''
  1171.      return 4
  1172.    end
  1173.  
  1174.    landrv = substr(os2path, ibmlanp-1, 1)
  1175.    lanpath = landrv':\IBMLAN'
  1176.  
  1177.    fname = lanpath'\IBMLAN.INI'
  1178.  
  1179.    /* read IBMLAN.INI looking for the RPLDIR entry */
  1180.    do until lines(fname) = 0
  1181.       data = translate(linein(fname))
  1182.       rpldirp = pos('RPLDIR', data)
  1183.       if rpldirp <> 0 then do
  1184.          rpldirp = pos('=', data)
  1185.          rpldir = strip(substr(data, rpldirp+1))
  1186.          Leave
  1187.       end
  1188.    end
  1189.    Call stream fname,C,'close'
  1190.  
  1191.    if rpldir = '' then do
  1192.       msgdata = errprefix || message.13
  1193.       Call Display_Log_Msg msgdata, ''
  1194.       return 4
  1195.    end
  1196.    return 0
  1197.  
  1198.  
  1199.  
  1200. /* Process command line parameters */
  1201. Process_Input_Parameters:
  1202.    Arg  parm.1, parm.2, parm.3
  1203.    Do i = 1 to 3
  1204.       If parm.i = '' Then Leave
  1205.       parmtype = substr(parm.i,1,2)
  1206.       select
  1207.          when parmtype = '?' Then Call Syntax_Help
  1208.  
  1209.          when parmtype = '/H' Then Call Syntax_Help
  1210.  
  1211.          when parmtype = '/L' Then Do
  1212.             /* Logfile parameter */
  1213.             if substr(parm.i, 3, 1) = ':' Then Logfile = substr(parm.i, 4)
  1214.             else Logfile = substr(parm.i, 3)
  1215.          end
  1216.  
  1217.          when parmtype = '/S' Then Do
  1218.             /* Sourcepath parameter */
  1219.             if substr(parm.i, 3, 1) = ':' Then SourcePath = substr(parm.i, 4)
  1220.             else SourcePath = substr(parm.i, 3)
  1221.             If substr(SourcePath, length(SourcePath), 1) <> '\' Then Do
  1222.                /* insure path ends in a \ */
  1223.                SourcePath = SourcePath || '\'
  1224.             end
  1225.          end
  1226.  
  1227.          otherwise Do
  1228.             msgdata = errprefix || message.4
  1229.             Call Display_Log_Msg msgdata, parm.i
  1230.             return 4
  1231.          end
  1232.       end
  1233.    end
  1234.    return 0
  1235.  
  1236.  
  1237. Syntax_Help:
  1238.    do i = 30 to 33
  1239.       Call Display_Log_Msg message.i, ''
  1240.    end
  1241.    exit
  1242.  
  1243.  
  1244.  
  1245. Initialize_NLS_Messages:
  1246. /***********************************************************************/
  1247. /*                            NLS messages                             */
  1248. /*                                                                     */
  1249. /* The following message strings should be translated for NLS support. */
  1250. /*                                                                     */
  1251. /* Note: The %1, %2, etc. strings represent dynamic data fields that   */
  1252. /*       are filled in when the message is displayed.  Do not          */
  1253. /*       translate the %1, %2, etc. fields.                            */
  1254. /*       The 'CRLF,' sequence that ends some lines represents          */
  1255. /*       formatting control (new line) and should not be translated.   */
  1256. /*       However, after translation, each message may need to be       */
  1257. /*       manually reformatted to prevent excessive length message      */
  1258. /*       lines. The message display code does not automatically        */
  1259. /*       reformat long message lines.                                  */
  1260. /***********************************************************************/
  1261. arg message_type
  1262.    /* error message prefix */
  1263.    errprefix = 'ERROR: '
  1264.  
  1265.    /* warning prefix */
  1266.    warnprefix = 'WARNING: '
  1267.  
  1268.    /* yes/no response */
  1269.    yesresponse = 'Y'
  1270.    noresponse = 'N'
  1271.  
  1272.    /* start of error messages */
  1273.    message.1 = 'Missing keyword in '
  1274.    message.2 = 'HISTORY LOG: '
  1275.    message.3 = 'Unable to open the Logfile '
  1276.    message.4 = 'The option %1 is not a valid option.'
  1277.    message.5 = 'Unable to determine the boot driver id.'
  1278.    message.6 = 'Unable to determine where LAN Server is installed.'
  1279.    message.7 = 'Unable to determine the server name.'
  1280.    message.8 = 'DEFALT21.FIT was not updated.'
  1281.    message.9 = 'Error copying %1 to %2.'
  1282.    message.10 = 'PKUNZIP2 Error while installing %1 to %2.'
  1283.    message.11 = 'The level of LAN Server installed is %1.  This level of',
  1284.                 'LAN Server can not be updated to support OS/2 2.1.'
  1285.    message.12 = 'The level of LAN Server installed is %1.  This level of',
  1286.                 'LAN Server does not need to be upgraded.'
  1287.    message.13 = 'The RPLDIR parameter was not found in IBMLAN.INI.'
  1288.    message.14 = 'OS/2 2.1 is not installed in the RIPL directory tree.  The OS/2 2.1',
  1289.                 'version of RIPLINST.EXE must be run to install OS/2 2.1 in the',
  1290.                 'RIPL directory tree prior to running RPLMIG21.CMD'
  1291.  
  1292.    /* start of informational messages */
  1293.    message.15 = 'RPL.MAP was updated to support OS/2 2.1.'
  1294.    message.16 = 'OS221*.CNF files were created.'
  1295.    message.17 = 'DEFALT21.FIT was updated.'
  1296.    message.18 = 'Copying %1 to %2.'
  1297.    message.19 = 'Installing %1 to %2.'
  1298.    message.20 = 'DEFALT21 directories were created.'
  1299.    message.21 = 'Master CONFIGRI.20 files were updated.'
  1300.    message.22 = 'DEFALT2A directories and files were created.'
  1301.    message.23 = 'Default OS/2 2.1 client INI files do not exist.  Run the GETRPL',
  1302.                 'utility to create the default INI files before defining any',
  1303.                 '2.1 RIPL client machines.'
  1304.    message.24 = 'RPLMIG21.CMD has already been run.  Do you wish to rerun it (Y/N)?'
  1305.  
  1306.    /* start of syntax help messages */
  1307.    message.30 = '%I14 ',
  1308.                 'RPLMIG21.CMD  [ ? | /h | /H] [/S:Sourcepath] [/L:Logfile]'CRLF,
  1309.                 ' '
  1310.    message.31 = '%T4 %I11 ',
  1311.                 'where ? or /h or /H is a request for this help panel.  If specified, it',
  1312.                 'must be first parameter.'CRLF,
  1313.                 ' '
  1314.    message.32 = '%T10 %I3 ',
  1315.                 '/S:Sourcepath is the fully qualified path to the root directory',
  1316.                 'which contains the files to be installed by RPLMIG21.  The',
  1317.                 'default value is A:\.' CRLF,
  1318.                 ' '
  1319.    message.33 = '%T10 %I3 ',
  1320.                 '/L:Logfile is the fully qualified name of a file to which all',
  1321.                 'messages and errors are to be logged.  If Logfile is specified,',
  1322.                 'no messages or errors will be displayed on the screen.'CRLF,
  1323.                 ' '
  1324.  
  1325.    return
  1326.