home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 17 Fixes30 / 17-Fixes30.zip / csf140.zip / csf / ibmdapln < prev    next >
Text File  |  1998-12-16  |  7KB  |  170 lines

  1. /******************************************************************/
  2. /*                 Started from OS2SERV.EXE                       */
  3. /******************************************************************/
  4. /* Run   SERVICE.EXE or FSERVICE.EXE based on information         */
  5. /* in the IBMDAPLN.CTL file in the \OS2\INSTALL directory         */
  6. /*                                                                */
  7. /* Control file will have one record with the following           */
  8. /*                                                                */
  9. /* x:\csf x:\fixpak log debug pstat svdrives nnnnnnnn.exe parms   */
  10. /*                                                                */
  11. /* x:\csf=CSF files on the CD                                     */
  12. /* x:\fixpak=fixpak source to apply on the CD                     */
  13. /* log=path to log file                                           */
  14. /* debug=1 if active, 0 if not                                    */
  15. /* svdrives=number of drives being serviced                       */
  16. /* nnnnnnnn=SERVICE or FSERVICE                                   */
  17. /* parms are /R: and /S: for FSERVICE.EXE                         */
  18. /*                                                                */
  19. /* Delete the control file and exit immediately. This             */
  20. /* tells OS2SERV.EXE to finish up.                                */
  21. /*                                                                */
  22. /* v1.33 - implement use of csfdriveapply variable                */
  23. /*       - use IBMDAPAT (attrib) to reset/set R/O flag            */
  24. /*       - of log file.                                           */
  25. /*       - use date('S') for Y2K 4 digit year                     */
  26. /* v2.01 - remove pstat_cmd as parm, always use ibmdapps          */
  27. /******************************************************************/
  28. '@Echo off'
  29. Parse Source . . me .                                        /* Who we are */
  30.  
  31. /***********************************/
  32. /* Register all REXXUTIL functions */
  33. /***********************************/
  34. rc=RxFuncAdd('SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs')
  35. Call SysLoadFuncs
  36.  
  37. /*******************/
  38. /* Find boot drive */
  39. /*******************/
  40. env='OS2ENVIRONMENT'                                   /* Environment name */
  41. boot=Filespec('DRIVE',Value('COMSPEC',,env))            /* Find Boot drive */
  42. tempfile=SysTempFileName(boot||'\OS2\INSTALL\OS2SERV.???')    /* Work file */
  43.  
  44. /***************************************************/
  45. /* This is the control file created by OS2SERV.EXE */
  46. /* before it called us. Make sure it's there. Exit */
  47. /* if it's not.                                    */
  48. /***************************************************/
  49. control=boot||'\OS2\INSTALL\IBMDAPLN.CTL'
  50.  
  51. If stream(control,'C','Query Exists')='' then
  52.   Do
  53.     log=boot||'\OS2\INSTALL\SERVICE.LOG'        /* Normal service log file */
  54.     Call Logger control' not found.'
  55.     Signal Done
  56.   End
  57.  
  58. Call stream control,'C','Open Read'
  59. Parse value linein(control) with csfpath fullpath log debug,
  60.   svdrives service_cmd parms                               /* v1.33, v2.01 */
  61. Call stream control,'C','Close'
  62. service=service_cmd='SERVICE.EXE'
  63. If debug then
  64.   Call Logger 'CONTROL DATA: 'csfpath fullpath log debug,
  65.     svdrives service_cmd parms                   /* Remove pstat_cmd v2.01 */
  66.  
  67. /********************************/
  68. /* Change to the CSF directory. */
  69. /********************************/
  70. Call Directory(csfpath)
  71.  
  72. /****************************************************/
  73. /* Set the environment vars for SERVICE or FSERVICE */
  74. /* and then start. If servicing a single drive,     */
  75. /* pass that drive to speed up service apply.       */
  76. /****************************************************/
  77. svdrives=translate(svdrives,' ','#')                              /* v1.33 */
  78. If words(svdrives)=1 Then                 /* v1.33 Servicing single drive? */
  79.   x=value('CSFDRIVEAPPLY',svdrives,'OS2ENVIRONMENT')/* v1.33 Yes, set variable */
  80. If service Then                                    /* Will run SERVICE.EXE */
  81.   Do
  82.     x=Value('CSFCDROMDIR',fullpath,'OS2ENVIRONMENT')
  83.     x=Value('CSFUTILPATH',csfpath,'OS2ENVIRONMENT')
  84.     If debug then
  85.       Call Logset
  86.     Call Logger 'START 'service_cmd
  87.     'START 'service_cmd
  88.   End
  89. Else                                              /* Will run FSERVICE.EXE */
  90.   Do
  91.     x=Value('REMOTE_INSTALL_STATE','0','OS2ENVIRONMENT')
  92.     If debug then
  93.       Call Logset
  94.     Call Logger 'START /F /FS /C 'service_cmd parms
  95.     'START /F /FS /C 'service_cmd parms
  96.   End
  97.  
  98. /************************************************/
  99. /* Now monitor the program using PSTAT. When it */
  100. /* ends we continue processing. Check every 10  */
  101. /* seconds till the started program goes away.  */
  102. /************************************************/
  103. Do forever
  104.   If stream(tempfile,'C','Query exist')<>'' then
  105.     x=SysFileDelete(tempfile)
  106.   Call SysSleep(10)
  107.   'IBMDAPPS /C > 'tempfile        /* Use IBMDAPPS, pstat_cmd removed v2.01 */
  108.   found=0
  109.   Call Stream tempfile,'C','Open Read'
  110.   Do while lines(tempfile)
  111.     data=linein(tempfile)
  112.     If pos(service_cmd,data)>0 then
  113.       Do
  114.         found=1
  115.         Leave
  116.       End
  117.   End
  118.   Call Stream tempfile,'C','Close'
  119.   If \found Then                                             /* Not there? */
  120.     Leave                                                 /* Yes, all done */
  121. End
  122. If stream(tempfile,'C','Query exist')<>'' then
  123.   x=SysFileDelete(tempfile)
  124.  
  125. x=value('CSFDRIVEAPPLY','','OS2ENVIRONMENT')                      /* v1.33 */
  126. If service then
  127.   Do
  128.     x=Value('CSFCDROMDIR','','OS2ENVIRONMENT')
  129.     x=Value('CSFUTILPATH','','OS2ENVIRONMENT')
  130.   End
  131. Else
  132.   x=Value('REMOTE_INSTALL_STATE','','OS2ENVIRONMENT')
  133.  
  134. x=SysFileDelete(me)                                      /* Delete ourself */
  135. x=SysFileDelete(control)                        /* Delete the control file */
  136.  
  137. /*******************************/
  138. /* Only exit from this program */
  139. /*******************************/
  140. Done:
  141. 'EXIT'                                           /* Close the OS/2 session */
  142. Exit
  143.  
  144. /****************************/
  145. /* Log all environment vars */
  146. /****************************/
  147. Logset:
  148. '@SET >' tempfile
  149. Call stream tempfile,'C','Open Read'
  150. Do while lines(tempfile)
  151.   Call Logger linein(tempfile)
  152. End
  153. Call stream tempfile,'C','Close'
  154. x=SysFileDelete(tempfile)
  155. Return
  156.  
  157. /*********************************************************/
  158. /* Write passed data to log file, preceded by date/time. */
  159. /*********************************************************/
  160. Logger:
  161. Parse arg logdata
  162. Parse value date('S') with 1 yy +4 mm +2 dd +2 .
  163. l=yy||'/'mm||'/'dd time() logdata
  164. '@IBMDAPAT -R' log
  165. Call Stream log,'C','Open Write'
  166. Call Lineout log,l
  167. Call Stream log,'C','Close'
  168. '@IBMDAPAT +R' log
  169. Return
  170.