home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / cidlan.zip / DRIVERS.CMD
OS/2 REXX Batch file  |  1994-04-23  |  11KB  |  206 lines

  1. /***************************************************************************/
  2. /* DRIVERS.CMD                                                             */
  3. /*                                                                         */
  4. /* CID installation of LAN drivers and protocols not included with NTS/2   */
  5. /*                                                                         */
  6. /* Using this command file eliminates the need to add your LAN adapter     */
  7. /* .NIF files and drivers to the NTS/2 MACS.ZIP and PROTOCOL.ZIP files.    */
  8. /*                                                                         */
  9. /* Install this command file by copying it to your \CID\EXE subdirectory.  */
  10. /* Then create the following directory structure in \CID\IMG:              */
  11. /*     MD \CID\IMG\DRIVERS                                 └─DRIVERS       */
  12. /*     MD \CID\IMG\DRIVERS\MACS                              ├─MACS        */
  13. /*     MD \CID\IMG\DRIVERS\PROTOCOL                          ├─PROTOCOL    */
  14. /*     MD \CID\IMG\DRIVERS\ROOT                              └─ROOT        */
  15. /* Copy any LAN adapter .NIF files and drivers, such as ELNK3.NIF and      */
  16. /* ELNK3.OS2 to the \CID\IMG\DRIVERS\MACS subdirectory.  Copy any protocol */
  17. /* .NIF files and drivers, such as ODI2NDI.NIF and ODI2NDI.OS2, to the     */
  18. /* \CID\IMG\DRIVERS\PROTOCOL subdirectory.  Copy any files which must be   */
  19. /* located in the root directory, such as EAGLEMAC.BIN for a Thomas-Conrad */
  20. /* Token-Ring adapter, to the \CID\IMG\DRIVERS\ROOT subdirectory.  If you  */
  21. /* have no files for the root directory, the COPY command for the ROOT     */
  22. /* directory should be deleted from this command file (below).             */
  23. /*                                                                         */
  24. /* You also need to create a "response file" which simply contains one     */
  25. /* DEVICE= line which is to be appended to the client's CONFIG.SYS file:   */
  26. /*     DEVICE=C:\IBMCOM\MACS\driver.OS2                                    */
  27. /*                                                                         */
  28. /* DRIVERS.CMD must be added to CASBASIC.FIL, so that the LAN adapter      */
  29. /* drivers will be installed as part of the CID install process.  Add the  */
  30. /* following line in the ":vars" section at the beginning of CASBASIC.FIL: */
  31. /*     exepath=x:\exe       /* This is where all the CID .CMD files are */ */
  32. /* Add the following lines after LAPS /E:PREP but before the two THINIFS   */
  33. /* commands in the first group of install commands (OVERALL_STATE = 0):    */
  34. /*     "exepath"\drivers "client"                                          */
  35. /*                       "bootdrive"                                       */
  36. /*                       x:\log                             +              */
  37. /* Add the following lines after LAPS /E:MAINT but before the two THINIFS  */
  38. /* commands in the second group of install commands (OVERALL_STATE = 1):   */
  39. /*     "exepath"\drivers "client"                                          */
  40. /*                       "bootdrive"                                       */
  41. /*                       l:                                 +              */
  42. /*                                                                         */
  43. /* Next, use the updated CASBASIC.FIL as input to the CASPREP command to   */
  44. /* create a .CMD file for the installation of all required products.       */
  45. /*                                                                         */
  46. /* Before starting a CID service update, it is a good idea to issue the    */
  47. /* following COPY commands, so that critical files may be easily restored: */
  48. /*     COPY d:\CONFIG.SYS d:\OS2\INSTALL                                   */
  49. /*     COPY d:\STARTUP.CMD d:\OS2\INSTALL                                  */
  50. /*     COPY d:\OS2\OS2*.INI d:\OS2\INSTALL                                 */
  51. /*                                                                         */
  52. /* The driver installation is designed such that the drivers for all types */
  53. /* of adapters are installed on every system, for the sake of consistency. */
  54. /* Alternatively, the name of the driver to be installed could be passed   */
  55. /* as a parameter so that only the necessary drivers are installed on each */
  56. /* system.  In this case, the DEVICE= line which is added to CONFIG.SYS    */
  57. /* could be generated automatically, eliminating the response file.        */
  58. /*                                                                         */
  59. /* Please send any comments or questions via e-mail to Robert Simpson at   */
  60. /* CompuServe 71520,737, IBMMAIL(USN6NB6N), or Internet address            */
  61. /* usn6nb6n@ibmmail.com.                                                   */
  62. /***************************************************************************/
  63. /* Here is a sample of the directory structure used by this command file:  */
  64. /*                                                                         */
  65. /*     The volume label in drive X is OS2.                                 */
  66. /*                                                                         */
  67. /*     Directory of X:\img\drivers                                         */
  68. /*                                                                         */
  69. /*     2-28-94   4:32p     <DIR>           0  .                            */
  70. /*     2-28-94   4:32p     <DIR>           0  ..                           */
  71. /*     2-28-94   4:32p     <DIR>         465  macs                         */
  72. /*     2-28-94   4:32p     <DIR>           0  protocol                     */
  73. /*     2-28-94   4:32p     <DIR>         313  root                         */
  74. /*             5 file(s)          0 bytes used                             */
  75. /*                                                                         */
  76. /*     Directory of X:\img\drivers\macs                                    */
  77. /*                                                                         */
  78. /*     2-28-94   4:32p     <DIR>           0  .                            */
  79. /*     2-28-94   4:32p     <DIR>           0  ..                           */
  80. /*     2-04-93   5:36p      1041           0  EL3IBMO2.NIF                 */
  81. /*     2-14-93  12:31p     22911           0  ELNK3.OS2                    */
  82. /*     5-12-92   3:33p     10337           0  EXP16.OS2                    */
  83. /*     2-12-92  11:49a      3971           0  OLITOK.NIF                   */
  84. /*     1-30-92   5:30a     16750           0  OLITOK.OS2                   */
  85. /*    10-27-93   3:57p      2702           0  TCCTOK.NIF                   */
  86. /*    10-27-93   1:38p     13999           0  TCCTOK.OS2                   */
  87. /*             9 file(s)      71711 bytes used                             */
  88. /*                                                                         */
  89. /*     Directory of X:\img\drivers\protocol                                */
  90. /*                                                                         */
  91. /*     2-28-94   4:32p     <DIR>           0  .                            */
  92. /*     2-28-94   4:32p     <DIR>           0  ..                           */
  93. /*     8-05-93  10:21a     31935           0  IFNDIS.SYS                   */
  94. /*     8-05-93  10:20a     99631           0  INET.SYS                     */
  95. /*     8-27-92  11:36a      2592           0  ODI2NDI.NIF                  */
  96. /*     9-15-92   3:57p     18484           0  ODI2NDI.OS2                  */
  97. /*     7-26-93   3:30p       142           0  TCPIP.NIF                    */
  98. /*             7 file(s)     152784 bytes used                             */
  99. /*                                                                         */
  100. /*     Directory of X:\img\drivers\root                                    */
  101. /*                                                                         */
  102. /*     2-28-94   4:32p     <DIR>           0  .                            */
  103. /*     2-28-94   4:32p     <DIR>           0  ..                           */
  104. /*     8-24-93  12:55a     26880           0  EAGLEMAC.BIN                 */
  105. /*             3 file(s)      26880 bytes used                             */
  106. /***************************************************************************/
  107.  
  108.  
  109.  
  110.  
  111. parse ARG client bootdrive logfile additional
  112.  
  113. "@echo off"
  114.  
  115. /* Determine whether drivers has already been executed */
  116.  
  117. state = value("CAS_DRIVERS",,"OS2ENVIRONMENT")
  118.  
  119. if state == '' then do
  120.    say "No CAS_DRIVERS in environment."
  121. end  /* Do */
  122. else do
  123.    say "CAS_DRIVERS="state
  124. end  /* Do */
  125.  
  126. /* Set good return code */
  127.  
  128. exitrc = x2d(FE00)
  129.  
  130. /* Make sure the client name was specified */
  131.  
  132. if client = '' then do
  133.    "echo ["date('u') time()"] Client name was not specified >>drivers.log"
  134.    exit x2d(1600)
  135. end  /* Do */
  136.  
  137. /* Display default values */
  138.  
  139. if logfile = '' then do
  140.    logfile = client".log"
  141.    "echo ["date('u') time()"] Log file parameter missing," logfile "was used >>"logfile
  142. end  /* Do */
  143.  
  144. if bootdrive = '' then do
  145.    "echo ["date('u') time()"] Boot drive parameter missing, current drive was used >>"logfile
  146. end  /* Do */
  147.  
  148. /* Begin installation */
  149.  
  150. "echo ["date('u') time()"] Installation of drivers begins... >>"logfile
  151. "echo ["date('u') time()"]     client="client ">>"logfile
  152. if bootdrive = '' then
  153.    "echo ["date('u') time()"]     bootdrive="substr(directory(),1,2) ">>"logfile
  154. else
  155.    "echo ["date('u') time()"]     bootdrive="bootdrive ">>"logfile
  156. "echo ["date('u') time()"]     logfile="logfile ">>"logfile
  157.  
  158. /* Copy the MAC and protocol drivers */
  159.  
  160. "echo ["date('u') time()"] Copying ROOT drivers to client's hard disk >>"logfile
  161. "copy x:\img\drivers\root\*.* "bootdrive"\ 2>>"logfile
  162. copyrc = rc
  163. if copyrc <> 0 then do
  164.    "echo ["date('u') time()"] Copy failed with return code" copyrc ">>"logfile
  165.    exitrc = x2d(FE04)
  166. end  /* Do */
  167.  
  168. "echo ["date('u') time()"] Copying MACS drivers to client's hard disk >>"logfile
  169. "copy x:\img\drivers\macs\*.* "bootdrive"\ibmcom\macs 2>>"logfile
  170. copyrc = rc
  171. if copyrc <> 0 then do
  172.    "echo ["date('u') time()"] Copy failed with return code" copyrc ">>"logfile
  173.    exitrc = x2d(0812)
  174. end  /* Do */
  175.  
  176. "echo ["date('u') time()"] Copying PROTOCOL drivers to client's hard disk >>"logfile
  177. "copy x:\img\drivers\protocol\*.* "bootdrive"\ibmcom\protocol 2>>"logfile
  178. if copyrc <> 0 then do
  179.    "echo ["date('u') time()"] Copy failed with return code" copyrc ">>"logfile
  180.    exitrc = x2d(0812)
  181. end  /* Do */
  182.  
  183. /* Make sure the response file exists */
  184.  
  185. rspfile = "x:\rsp\drivers\"client".rsp"
  186. if stream(rspfile,'c','query exists') == '' then do
  187.    "echo ["date('u') time()"] Response file" rspfile "does not exist >>"logfile
  188.     exit x2d(0800)
  189. end  /* Do */
  190.  
  191. /* Add the driver to CONFIG.SYS */
  192.  
  193. "echo ["date('u') time()"] Appending "client".RSP to "bootdrive"\CONFIG.SYS >>"logfile
  194. "copy "bootdrive"\CONFIG.SYS+x:\rsp\drivers\"client".rsp "bootdrive"\CONFIG.SYS 2>>"logfile
  195. if copyrc <> 0 then do
  196.    "echo ["date('u') time()"] Copy failed with return code" copyrc ">>"logfile
  197.    exitrc = x2d(0812)
  198. end  /* Do */
  199.  
  200. /* Indicate successful install */
  201.  
  202. "echo ["date('u') time()"] Installation of drivers completed with rc="exitrc ">>"logfile
  203.  
  204. exit exitrc
  205.  
  206.