home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Professional
/
OS2PRO194.ISO
/
os2
/
prgramer
/
rexx
/
rdebug
/
install.cmd
< prev
next >
Wrap
OS/2 REXX Batch file
|
1993-04-03
|
8KB
|
324 lines
/*H* INSTALL.REX 01-30-93 14:26*/
/* comes from an application control file */
/* Log into target drive: */
/* INSTALL drive target product */
/* INSTALL C: OS2 rDEBUG */
trace ?r
arg drive target product
Parse source sys .
call initial
call setup
call install_directories
call install_files
drive
call directory(product)
call install_desktop
exit 0
INSTALL_DIRECTORIES:
if sys='OS2' then do
if RxMessageBox(product 'will be installed in directory' directory 'on drive' drive'. ',
'Want to continue?','INSTALL.CMD','YesNo','Query')=7 then answer='N'
end
else do
say product 'will be installed in directory' directory 'on drive' drive
say 'Want to continue? (Yes/No)'
answer=inkey()
end
if left(answer,1)<>'Y' then exit 100
rc=MkDir(drive''directory)
if rc<>0 then do
msg.1=product 'may already be installed. Want to continue?'
if sys='OS2' then do
if RxMessageBox(msg.1,'INSTALL.CMD','YesNo','Query')=7 then answer='N'
end
else do
say product 'may already be installed. Want to continue? (Yes/No)'
pull answer
end
if left(answer,1)<>'Y' then exit 100
/*
do i=1 to files
call DeleteFile drive''directory'\'files.i
end
*/
end
parse value DriveInfo(drive) with . free .
if free < required_space then do
msg.1='Product' product 'requires' required_space
msg.2= 'bytes of storage. You only have' free 'bytes'
msg.3= 'available. Please make more space available on'
msg.4= 'the drive' drive 'and try again.'
if sys='OS2' then do
if RxMessageBox(msg.1 msg.2 msg.3 msg.4,'INSTALL.CMD','YesNo','Query')=7 then answer='N'
end
else do
say msg.1
say msg.2
say msg.3
say msg.4
end
exit 100
end
do i=1 to directories
rc=MkDir(drive''directories.i)
end
return
INSTALL_FILES:
do i=1 to files
say 'Copying' files.i
type=right(files.i,4)
select
when target='ALL' then
call quiet 'Copy' files.i drive''directory'\'files.i '>nul'
when wordpos(type,'.KEX .CMD .REX')>0 then call edit
otherwise
call quiet 'Copy' files.i drive''directory'\'files.i '>nul'
end
end
return
edit:
/* remove next if statement when full install is debugged */
editlist='DEBUGRUN.KEX RDBCMDS.KEX RDBUI.KEX RDBUIEXT.OS2',
'RDBMENU.KEX RDBTASK.KEX RDBMISC.KEX RDBPROF.KEX'
if wordpos(files.i,editlist)=0 then do
call quiet 'Copy' files.i drive''directory'\'files.i '>nul'
return; end
if sys='OS2' then do
'@set rdparms=' files.i target bbs? drive''directory'\'
editor files.i '(PROF rdxGEN'; end
if sys='DOS' then do
Queue ' MACRO rdxgen /GEN' files.i target drive''directory'\'
editor files.i '(PROF rdprofil'; end
return
QUIET: arg cmd
if sys='DOS' then do
cmd
return 0; end
if sys='OS2' then '@'cmd
return
MkDir: arg dir
if sys='DOS' then do
'md' dir
return 0; end
if sys='OS2' then return SysMkDir(dir)
return
DeleteFile: arg dfiles
if sys='DOS' then do
'del' dfiles
end
else call SysFileDelete dfiles
return
DriveInfo: arg dr
if sys='DOS' then do
return 0 1000
end
if sys='CMS' then do
say 'Requires more code in driveinfo rtn'
return 0 1000
end
return SysDriveInfo(dr)
return 0 1000
SETUP:
file=product'.CTL'
files=0
required_space=0
directories=0
line= linein(file)
do until lines(file)=0
parse var line type value
select
when type='FILE' then do
parse value value with filename code /*!1*/
if code = 'T' then do /*!1*/
if state(filename)<>1 then iterate; end /*!1*/
files=files + 1
/*!1 files.files= value */
files.files= filename /*!1*/
code.files= code /*!1*/
end
when type ='SUBDIRECTORY' then do
directories=directories + 1
directories.directories= value
end
when type ='DIRECTORY' then directory=value
when type ='SPACE' then required_space=required_space+value
otherwise nop
end
line=linein(file)
end
call lineout file
return
RxMessageBox: parse arg msg.1,, prompt
say msg.1 prompt
pull answer
if left(answer,1)='Y' then answer='Y'
else answer=7 /*NO*/
return answer
install_desktop:
call createfolder
title = program
program = 'rDEBUG.cmd'
fullname = 'C:\'product'\'program
Setup = ";EXENAME="fullname
Setup = Setup";PARAMETERS=?"
Setup = Setup";PROGTYPE=OS2FULLSCREEN"
Setup = Setup";STARTUPDIR=C:\"product
Setup = Setup";WORKINGDIR=C:\"product
call createprogram
title = 'D:\rDEBUG'
program = 'rDEBUG.cmd'
fullname = 'C:\'product'\'program
Setup = ";EXENAME="fullname
Setup = Setup";PARAMETERS=?"
Setup = Setup";PROGTYPE=OS2FULLSCREEN"
Setup = Setup";STARTUPDIR=D:\"product
Setup = Setup";WORKINGDIR=D:\"product
call createprogram
title = 'TESTPROF'
program = 'rDEBUG.cmd'
fullname = 'C:\'product'\'program
Setup = ";EXENAME="fullname
Setup = Setup";PARAMETERS=profile"
Setup = Setup";PROGTYPE=OS2FULLSCREEN"
Setup = Setup";STARTUPDIR=C:\"product
Setup = Setup";WORKINGDIR=C:\"product
call createprogram
title = 'DEMO'
program = 'rDEBUG.cmd'
fullname = 'C:\'product'\'program
Setup = ";EXENAME="fullname
Setup = Setup";PARAMETERS="
Setup = Setup";PROGTYPE=OS2FULLSCREEN"
Setup = Setup";STARTUPDIR=C:\"product
Setup = Setup";WORKINGDIR=C:\"product
call createprogram
title = 'HELP'
program = 'E.exe'
fullname = program
Setup = ";EXENAME="fullname
Setup = Setup";PARAMETERS=C:\rDEBUG\rDEBUG.hlp"
Setup = Setup";PROGTYPE=OS2FULLSCREEN"
Setup = Setup";STARTUPDIR=C:\"product
Setup = Setup";WORKINGDIR=C:\"product
call createprogram
title = 'README'
program = 'E.exe'
fullname = program
Setup = ";EXENAME="fullname
Setup = Setup";PARAMETERS=C:\rDEBUG\README.OS2"
Setup = Setup";PROGTYPE=OS2FULLSCREEN"
Setup = Setup";STARTUPDIR=C:\"product
Setup = Setup";WORKINGDIR=C:\"product
call createprogram
return
CREATEFOLDER:
location='<WP_DESKTOP>'
Setup = "OBJECTID=<"product">"
status='UPDATE'
msg.1='Unable to created folder for' product
if SysCreateObject("WPFolder",product,location,setup,status)=1 then nop
else do
if sys='OS2' then call RxMessageBox msg.1,'OK','ERROR'
else say msg.1
exit
end
return
CREATEPROGRAM:
arg program
location='<UWP_'product'>'
location='<WP_DESKTOP>'
location='<'product'>'
status='FAILIFEXIST'
status='UPDATE'
status=''
msg.1='Unable to created program object:' product 'for' product 'folder'
if SysCreateObject("WPProgram",title,location,setup,)=1 then nop
else do
if sys='OS2' then call RxMessageBox msg.1,'OK','ERROR'
else say msg.1
exit
end
return
LoadFunctions: procedure
/*
** This will load the DLL for the Rexx system functions supplied
** with OS/2 v2.0
*/
call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
call SysLoadFuncs
return
Return; STATE:
/* To provide compatibility With state module in Cms & OS2 */
Arg specs
If sys.dos Then Do
If lines(specs) Then src=1
else src=28; end
else if sys.os2 then do /*O*/
If lines(specs) Then src=1
else src=28; end
Else 'STATE' specs
Return src
INITIAL:
Parse source sys .
if sys='OS/2' then sys='OS2'
else if sys='PCDOS' then sys='DOS'
if sys='OS2' then call LoadFunctions
sys.=0
if sys='OS2' then sys.os2=1
if sys='DOS' then sys.dos=1
/*!1 drive=left(syssearchpath( 'path', '\nul'),2) */
if drive ='' then drive='C:'
if right(drive,1)<>':' then drive=drive':'
if target ='' then target='ALL' /*!1*/
bbs?=0
if wordpos(target,'ALL OS2 *DOS *CMS')=0 then do
msg.1=sys 'system not supported with this version',,
if sys='OS2' then call RxMessageBox msg.1, 'INSTALL.CMD','OK','ERROR'
else say msg.1
exit
end
if product ='' then product='rDEBUG'
if sys='CMS' then editor='XEDIT'
if sys='OS2' then editor='KEDIT'
if sys='DOS' then do
editor='KEDIT'; end
if sys='OS2' then call LoadFunctions
do while target=''
say 'Indicate what system to generate: OS2 DOS CMS or ALL'
pull answer
ans=left(answer,1)
select
when ans='O' then target='OS2'
when ans='D' then target='DOS'
otherwise
msg.1='System:' answer 'currently not supported'
if sys='OS2' then call RxMessageBox msg.1,'INSTALL.CMD','OK','ERROR'
else say msg.1
exit
end
end
return