home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 17 Fixes30
/
17-Fixes30.zip
/
csf140.zip
/
csf
/
ibmdapln
< prev
next >
Wrap
Text File
|
1998-12-16
|
7KB
|
170 lines
/******************************************************************/
/* Started from OS2SERV.EXE */
/******************************************************************/
/* Run SERVICE.EXE or FSERVICE.EXE based on information */
/* in the IBMDAPLN.CTL file in the \OS2\INSTALL directory */
/* */
/* Control file will have one record with the following */
/* */
/* x:\csf x:\fixpak log debug pstat svdrives nnnnnnnn.exe parms */
/* */
/* x:\csf=CSF files on the CD */
/* x:\fixpak=fixpak source to apply on the CD */
/* log=path to log file */
/* debug=1 if active, 0 if not */
/* svdrives=number of drives being serviced */
/* nnnnnnnn=SERVICE or FSERVICE */
/* parms are /R: and /S: for FSERVICE.EXE */
/* */
/* Delete the control file and exit immediately. This */
/* tells OS2SERV.EXE to finish up. */
/* */
/* v1.33 - implement use of csfdriveapply variable */
/* - use IBMDAPAT (attrib) to reset/set R/O flag */
/* - of log file. */
/* - use date('S') for Y2K 4 digit year */
/* v2.01 - remove pstat_cmd as parm, always use ibmdapps */
/******************************************************************/
'@Echo off'
Parse Source . . me . /* Who we are */
/***********************************/
/* Register all REXXUTIL functions */
/***********************************/
rc=RxFuncAdd('SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs')
Call SysLoadFuncs
/*******************/
/* Find boot drive */
/*******************/
env='OS2ENVIRONMENT' /* Environment name */
boot=Filespec('DRIVE',Value('COMSPEC',,env)) /* Find Boot drive */
tempfile=SysTempFileName(boot||'\OS2\INSTALL\OS2SERV.???') /* Work file */
/***************************************************/
/* This is the control file created by OS2SERV.EXE */
/* before it called us. Make sure it's there. Exit */
/* if it's not. */
/***************************************************/
control=boot||'\OS2\INSTALL\IBMDAPLN.CTL'
If stream(control,'C','Query Exists')='' then
Do
log=boot||'\OS2\INSTALL\SERVICE.LOG' /* Normal service log file */
Call Logger control' not found.'
Signal Done
End
Call stream control,'C','Open Read'
Parse value linein(control) with csfpath fullpath log debug,
svdrives service_cmd parms /* v1.33, v2.01 */
Call stream control,'C','Close'
service=service_cmd='SERVICE.EXE'
If debug then
Call Logger 'CONTROL DATA: 'csfpath fullpath log debug,
svdrives service_cmd parms /* Remove pstat_cmd v2.01 */
/********************************/
/* Change to the CSF directory. */
/********************************/
Call Directory(csfpath)
/****************************************************/
/* Set the environment vars for SERVICE or FSERVICE */
/* and then start. If servicing a single drive, */
/* pass that drive to speed up service apply. */
/****************************************************/
svdrives=translate(svdrives,' ','#') /* v1.33 */
If words(svdrives)=1 Then /* v1.33 Servicing single drive? */
x=value('CSFDRIVEAPPLY',svdrives,'OS2ENVIRONMENT')/* v1.33 Yes, set variable */
If service Then /* Will run SERVICE.EXE */
Do
x=Value('CSFCDROMDIR',fullpath,'OS2ENVIRONMENT')
x=Value('CSFUTILPATH',csfpath,'OS2ENVIRONMENT')
If debug then
Call Logset
Call Logger 'START 'service_cmd
'START 'service_cmd
End
Else /* Will run FSERVICE.EXE */
Do
x=Value('REMOTE_INSTALL_STATE','0','OS2ENVIRONMENT')
If debug then
Call Logset
Call Logger 'START /F /FS /C 'service_cmd parms
'START /F /FS /C 'service_cmd parms
End
/************************************************/
/* Now monitor the program using PSTAT. When it */
/* ends we continue processing. Check every 10 */
/* seconds till the started program goes away. */
/************************************************/
Do forever
If stream(tempfile,'C','Query exist')<>'' then
x=SysFileDelete(tempfile)
Call SysSleep(10)
'IBMDAPPS /C > 'tempfile /* Use IBMDAPPS, pstat_cmd removed v2.01 */
found=0
Call Stream tempfile,'C','Open Read'
Do while lines(tempfile)
data=linein(tempfile)
If pos(service_cmd,data)>0 then
Do
found=1
Leave
End
End
Call Stream tempfile,'C','Close'
If \found Then /* Not there? */
Leave /* Yes, all done */
End
If stream(tempfile,'C','Query exist')<>'' then
x=SysFileDelete(tempfile)
x=value('CSFDRIVEAPPLY','','OS2ENVIRONMENT') /* v1.33 */
If service then
Do
x=Value('CSFCDROMDIR','','OS2ENVIRONMENT')
x=Value('CSFUTILPATH','','OS2ENVIRONMENT')
End
Else
x=Value('REMOTE_INSTALL_STATE','','OS2ENVIRONMENT')
x=SysFileDelete(me) /* Delete ourself */
x=SysFileDelete(control) /* Delete the control file */
/*******************************/
/* Only exit from this program */
/*******************************/
Done:
'EXIT' /* Close the OS/2 session */
Exit
/****************************/
/* Log all environment vars */
/****************************/
Logset:
'@SET >' tempfile
Call stream tempfile,'C','Open Read'
Do while lines(tempfile)
Call Logger linein(tempfile)
End
Call stream tempfile,'C','Close'
x=SysFileDelete(tempfile)
Return
/*********************************************************/
/* Write passed data to log file, preceded by date/time. */
/*********************************************************/
Logger:
Parse arg logdata
Parse value date('S') with 1 yy +4 mm +2 dd +2 .
l=yy||'/'mm||'/'dd time() logdata
'@IBMDAPAT -R' log
Call Stream log,'C','Open Write'
Call Lineout log,l
Call Stream log,'C','Close'
'@IBMDAPAT +R' log
Return