home *** CD-ROM | disk | FTP | other *** search
- /*********************************************************************/
- /* */
- /* Instalation program for CDCOPY package */
- /* */
- /* Author: Michel SUCH, Email: msuch@ibm.net */
- /* */
- /* OS2ASPI.DMD handling added by C. Wohlgemuth */
- /* */
- /*********************************************************************/
-
- call init_prog
- call update_config
- exit
-
-
- init_prog:
-
- say "Installation program for CDCOPY Version 1.0"
- say "Author: Michel SUCH. Email: msuch@ibm.net"
- say ""
- parse source . . progname .
- x = pos( filespec('n', progname), progname) - 2
- rundir = substr(progname, 1, x)
-
- bootdrv = translate(value('PATH', , 'os2environment'))
- parse var bootdrv bootdrv':\OS2;'rest
- bootdrv = substr(bootdrv, length(bootdrv))
- /*------------------- Init Rexxutil-----------------------------------*/
- If RXFUNCQUERY('SysLoadFuncs') Then Do
- Call rxfuncadd 'SysLoadFuncs', 'REXXUTIL', 'SYSLOADFUNCS'
- Call sysloadfuncs
- End
- configsys = bootdrv':\config.sys'
- configbak = bootdrv':\config.cdc'
- return /* init_prog */
-
-
- update_config:
-
- changed = 0
- driverfound = 0
- dmdfound = 0
- i = 1
- do while lines(configsys) <> 0
- config.i = translate(linein(configsys))
- line = strip(config.i)
- select
- when substr(line, 1, 8) = "SET PATH" then do
- if pos( translate(rundir), line) = 0 then do
- changed = 1
- if substr(config.i, length(config.i)) = ';' then
- config.i = config.i || rundir';'
- else
- config.i = config.i || ';' || rundir';'
- say "Path variable updated."
- end
- end
- when substr(line, 1, 7) = "DEVICE=" then do
- if pos("ASPIROUT.SYS", line) <> 0 then do
- if line = "DEVICE=" || translate(rundir)"\ASPIROUT.SYS" then do
- driverfound = 1
- end
- else do
- config.i = "device="rundir"\aspirout.sys"
- say "Line:" config.i "updated in file" configsys
- changed = 1
- driverfound = 1
- end
- end
- end
- when substr(line, 1, 8) = "BASEDEV=" then do
- if pos("OS2ASPI.DMD", line) <> 0 then do
- config.i = "BASEDEV=OS2ASPI.DMD /ALL"
- say "Line:" config.i "updated in file" configsys
- dmdfound = 1
- end
-
- end
- otherwise nop
- end
- i = i + 1
- end
- call stream configsys, 'c', 'close'
- if driverfound = 0 then do
- changed = 1
- config.i = "device="rundir"\aspirout.sys"
- config.0 = i
- say "Line:" config.i "added to file" configsys
- end
- else config.0 = i-1
- if dmdfound = 0 then do
- changed = 1
- i=i+1
- config.i = "BASEDEV=OS2ASPI.DMD /ALL"
- config.0 = i
- say "Line:" config.i "added to file" configsys
- end
- if changed = 1 then do
- "@COPY" configsys configbak ">nul 2>nul"
- if rc <> 0 then do
- say "Cannot backup file" configsys','
- say "program stopped."
- exit
- end
- else say "Original file" configsys "saved as" configbak
- ret = sysfiledelete(configsys)
- if ret <> 0 then do
- say "Cannot replace file" configsys","
- say "program stopped"
- exit
- end
- do i = 1 to config.0
- call lineout configsys, config.i
- end
- call stream configsys, 'c', 'close'
- say "Please reboot your system to finish installation."
- end
- else do
- say "Program CDCOPY already installed, no need to reboot."
- end
- return /* update_config */
-