home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 27 Fixes20 / 27-Fixes20.zip / XR0F048.2DK / unc.dsk / RPLSPDDI.CMD < prev    next >
OS/2 REXX Batch file  |  1994-01-14  |  9KB  |  236 lines

  1. /* Rexx procedure to install the OS/2 Service Pack Display Driver   */
  2. /* diskettes in the Remote IPL directory tree.                      */
  3. /*                                                                  */
  4. /* Note: The OS/2 Service Pack must have already been installed     */
  5. /*       in the Remote IPL directory tree.                          */
  6. /*                                                                  */
  7.  
  8. Parse Arg  p1 p2 .
  9. /* Check for help request (p1 = ? or /h or /H) */
  10. If p1 = '?' | p1 = '/h' | p1 = '/H' Then Call Syntax_Help
  11.  
  12. parm.1 = p1
  13. parm.2 = p2
  14. drive = 'A'
  15. userrplr = ''
  16.  
  17. num_ds_diskettes = 2
  18. ds1_match = 'PSXGA32'
  19. ds2_match = 'PSCGA16'
  20.  
  21. Do i = 1 to 2
  22.    If parm.i = '' Then Leave
  23.    parmtype = translate(substr(parm.i,1,2))
  24.    select
  25.       when parmtype = '/D' Then Do
  26.          if substr(parm.i, 3, 1) = ':' Then drive = substr(parm.i, 4, 1)
  27.          else drive = substr(parm.i, 4, 1)
  28.          drive = translate(drive)
  29.       end
  30.  
  31.       when parmtype = '/O' Then Do
  32.          if substr(parm.i, 3, 1) = ':' Then userrplr = substr(parm.i, 4)
  33.          else userrplr = substr(parm.i, 3)
  34.       end
  35.  
  36.       otherwise Do
  37.         Say 'The option 'parm.i' is not a valid option.'
  38.         exit
  39.       end
  40.    end
  41. end
  42.  
  43. /* ensure that the REXXUTIL functions are registered. */
  44. Call RxFuncAdd 'SysLoadFuncs','RexxUtil','SysLoadFuncs'
  45. Call SysLoadFuncs
  46.  
  47. If userrplr <> '' Then riplroot = userrplr
  48. else Do
  49.    /* get RIPLINST root directory */
  50.    riplroot = SysIni(SYSTEM, 'RIPLInstall', 'RIPLInstallTarget')
  51.    if riplroot = 'ERROR:' Then Do
  52.       Say 'OS2SYS.INI does not contain the parameter specifying the default'
  53.       Say 'directory used by RIPLINST to install the OS/2 2.0 code in the'
  54.       Say 'Remote IPL directory tree.  If the OS/2 2.0 code was installed in'
  55.       Say 'the Remote IPL directory tree by some other means, rerun this '
  56.       Say 'procedure and use the /O option to specify the directory path for'
  57.       Say 'the OS/2 2.0 code.  For example:'
  58.       Say '   RPLSPDDI /O:C:\IBMLAN\RPL\OS2.2O'
  59.       exit
  60.    end
  61. end
  62.  
  63. /* verify that the OS/2 Service Pack has been installed by reading the */
  64. /* first 60 bytes of SYSLEVEL.OS2 and checking the current OS/2 level*/
  65. filename = riplroot'\OS2\INSTALL\SYSLEVEL.OS2'
  66. syslevel = ''
  67. Do i = 1 to 60
  68.    syslevel = syslevel || charin(filename)
  69. end
  70. Call Charout filename
  71.  
  72. /*Defect 60489 - the following 3 lines have been modified to make NLS independent */
  73.  
  74. verp = pos('XR', syslevel)
  75. version = substr(syslevel, verp+3, 4)
  76. If version < '6050' Then Do
  77.    Say 'The OS/2 Service Pack has not been installed in the 'riplroot
  78.    Say 'directory.  Install the OS/2 Service Pack prior to running RPLSPDDI.'
  79.    exit
  80. end
  81.  
  82. /* Original RIPLINST install put the DISPLAY.DLL file in the wrong */
  83. /* directory.  Copy the updated DISPLAY.DLL to the correct directory. */
  84. cmdline = '@COPY 'riplroot'\OS2\INSTALL\DISPLAY.DLL' riplroot'\OS2\DLL\'
  85. address CMD cmdline
  86.  
  87. Do disk = 1 to num_ds_diskettes
  88.    Do forever
  89.       Say 'Insert the OS/2 Service Pack Display Driver diskette 'disk' into drive 'drive'.'
  90.       Say 'Press Enter to continue..'
  91.       Beep(440, 250)
  92.       Pull dummy
  93.       /* set up filename match to check for correct diskette */
  94.       Select
  95.          when disk = 1 Then match = ds1_match
  96.          when disk = 2 Then match = ds2_match
  97.          otherwise;
  98.       end
  99.       filename = drive':\'match'.DSP'
  100.       If chars(filename) <> 0 Then Do
  101.          /* file exists, exit insert diskette loop */
  102.          Call Charout filename  /* close file */
  103.          Leave
  104.       end
  105.    end
  106.    /* If ds1, create special XGA directory */
  107.    If disk = 1 Then Call sysMkDir riplroot'\XGA$DMQS'
  108.  
  109.    Call Unpack_diskette
  110. end
  111.  
  112. rplsetd_msg:
  113. Say 'The OS/2 Service Pack Display Driver files have been installed in the '
  114. Say 'Remote IPL directory tree.  Before any remote IPL workstations can be'
  115. Say 'booted using the new display drivers, the rexx procedure RPLSETD.CMD'
  116. Say 'must be used to update the remote IPL workstation definitions to use'
  117. Say 'the new display drivers.'
  118.  
  119. exit
  120. /* end main function */
  121.  
  122.  
  123. Unpack_diskette:
  124. /* create file containing list of files on diskette (and where they go) */
  125. Say 'Please wait while the diskette is checked for installable files.'
  126. tmpfile = SysTempFileName(RPLSPDDX.???)
  127. cmdline = '@UNPACK 'drive':\ /SHOW > 'tmpfile
  128. address CMD cmdline
  129.  
  130. Do While lines(tmpfile)
  131.    data = translate(linein(tmpfile))
  132.    if substr(data, 1, 2) = drive':' Then Do
  133.       packedpfn = data
  134.       packedfn = translate(filespec("name", data))
  135.    end
  136.    else If substr(data, 1, 2) = '->' Then Do
  137.       tempdata = substr(data, 3)
  138.       pathinfo = filespec("path", tempdata)
  139.       tgtfilename = translate(filespec("name", tempdata))
  140.       ibmdev32 = 0
  141.       ibmvga32 = 0
  142.       If tgtfilename = 'IBMDEV32.DLL' Then Do
  143.          /* IBMDEV32.DLL is a special case.  A number of files get renamed */
  144.          /* to IBMDEV32.DLL, we must preserve the original name. */
  145.          Select
  146.             When packedfn = 'SPEED480.DL_' Then ibmdev32 = 1
  147.             When packedfn = 'TSENG480.DL_' Then ibmdev32 = 1
  148.             When packedfn = 'TSENG600.DL_' Then ibmdev32 = 1
  149.             When packedfn = 'TSENG768.DL_' Then ibmdev32 = 1
  150.             Otherwise;
  151.          end
  152.       end
  153.       else If tgtfilename = 'IBMVGA32.DLL' Then Do
  154.          /* there are 2 versions of IBMVGA32.DLL, VGA type and SVGA type */
  155.          /* handle SVGA type special */
  156.          If packedfn = 'IBMSVGA.DL_' Then ibmvga32 = 1
  157.       end
  158.       If ibmdev32 = 1 | ibmvga32 = 1 Then Do
  159.          /* special processing for duplicate IBMDEV32.DLL/IBMVGA32.DLL named files */
  160.          originalname = substr(packedfn, 1, length(packedfn) - 1)||'L'
  161.  
  162.          /* delete original (if it exists) to prevent rename error */
  163.          Call SysFileDelete riplroot || pathinfo || originalname
  164.  
  165.          If ibmdev32 = 1 Then Do
  166.             /* set up IBMDEV32.DLL save/restore names */
  167.             srcfn = riplroot || pathinfo'IBMDEV32.DLL'
  168.             trgfn = ' IBMDEV32.BAK'
  169.             srcfn2 = riplroot || pathinfo'IBMDEV32.BAK'
  170.             trgfn2 = ' IBMDEV32.DLL'
  171.          end
  172.          else Do
  173.             /* set up IBMVGA32.DLL save/restore names */
  174.             srcfn = riplroot || pathinfo'IBMVGA32.DLL'
  175.             trgfn = ' IBMVGA32.BAK'
  176.             srcfn2 = riplroot || pathinfo'IBMVGA32.BAK'
  177.             trgfn2 = ' IBMVGA32.DLL'
  178.          end
  179.  
  180.          /* if duplicate name already exist, rename it temporarily */
  181.          Call SysFileTree srcfn, 'filelst', 'F'
  182.          If filelst.0 <> 0 Then Do
  183.             /* rename existing version of IBMDEV32.DLL/IBMVGA32.DLL */
  184.             cmdline = '@RENAME ' srcfn trgfn
  185.             address CMD cmdline
  186.             rename = 1
  187.          end
  188.          else rename = 0
  189.  
  190.          /* unpack file to IBMDEV32.DLL or IBMVGA32.DLL.  Unpack won't let */
  191.          /* us rename on the fly so we have to do it after the fact. */
  192.          Say 'Unpacking 'riplroot||pathinfo||originalname
  193.          cmdline = '@UNPACK 'packedpfn'  'riplroot || pathinfo' /N:'tgtfilename'  > nul'
  194.          address CMD cmdline
  195.  
  196.          /* rename IBMDEV32.DLL/IBMVGA32.DLL to it's packed name */
  197.          cmdline = '@RENAME 'riplroot || pathinfo ||tgtfilename' 'originalname
  198.          address CMD cmdline
  199.  
  200.          If rename = 1 Then Do
  201.             /* rename IBMDEV32.BAK/IBMVGA32.BAK back to */
  202.             /* IBMDEV32.DLL/IBMVGA32.DLL */
  203.             cmdline = '@RENAME 'srcfn2 trgfn2
  204.             address CMD cmdline
  205.          end
  206.       end
  207.       else Do
  208.          Say 'Unpacking 'riplroot||pathinfo||tgtfilename
  209.          cmdline = '@UNPACK 'packedpfn'  'riplroot || pathinfo' /N:'tgtfilename'  > nul'
  210.          address CMD cmdline
  211.       end
  212.       if chars() Then dummy = charin()
  213.    end
  214. end
  215. Call Lineout tmpfile   /* close file */
  216. Call SysFileDelete tmpfile
  217. Say '  '
  218. return
  219.  
  220.  
  221.  
  222. Syntax_Help:
  223.    Say ' RPLSPDDI [/H]  [/D:drive_id]  [/O:OS2_root_directory]'
  224.    Say ' '
  225.    Say '     /H is a request for this syntax help information.  If specified,'
  226.    Say '        it must be first and is the only parameter checked.'
  227.    Say ' '
  228.    Say '     /D:drive_id is the diskette drive id to use.  The default is A.'
  229.    Say ' '
  230.    Say '     /O:OS2_root_directory is the root Remote IPL directory in which'
  231.    Say '                           the OS/2 2.0 code is installed.  If this'
  232.    Say '                           parameter is not specified, the path saved'
  233.    Say '                           in OS2SYS.INI by RIPLINST is used.'
  234.    Say ' '
  235.    exit
  236.