/* ----------------------------------------------------------------------- */ /* Install emx library for ported Unix apps */ /* Author: F. Hodel A-Net GmbH, www.anetgmbh.ch */ /* use at your own risk! Please save your data fist! */ /* ----------------------------------------------------------------------- */ /* activate REXX Utils */ call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs' call SysLoadFuncs '@echo off' /* determine source drive for installation (CD or LAN drive) */ drivelist=SysDriveMap(,'USED') /* all local and LAN drives */ do forever parse var drivelist cddrv ' ' drivelist cddrv=strip(cddrv) filter = stream(cddrv'\cmd\inst_emx.cmd','c','query exists') if filter <> '' then leave end /* do forever */ say 'Quell-Laufwerk ist' cddrv /* determine boot drive */ bootdrv = SysBootDrive() say 'Boot drive is ' bootdrv ' searching EMX ...' say '' /* first check, if emx is already installed on system */ emxpath='' emxloc.1='' emxloc.2='' rc=SysFileTree(bootdrv||'\emxlibcm.dll','emxloc.','FS') /* search for emxlibcm.dll */ if rc==0 then do say 'EMX programs found in: ' say emxloc.1 say emxloc.2 parse var emxloc.1 date1 time number attribute emxpath1 parse var emxloc.2 date2 time number attribute emxpath2 emxpath1=strip(emxpath1) emxpath2=strip(emxpath2) emxpath=emxpath1 date=date1 if emxpath1==bootdrv||'\TVoice\Wiseprog\emx\dll\emxlibcm.dll' then do emxpath=emxpath2 date=date2 end /* if emxpath1== */ end /* if rc==0 */ /* if no emx found, define new default location */ if emxpath=='' then do emxpath=bootdrv||'\emx' say 'EMX seems not to be installed, i install EMX now to ' emxpath call SysSleep(4) 'xcopy ' cddrv||'\emx\*.* ' bootdrv||'\emx\ /s' end else do parse var emxpath emxpath with '\dll\emxlibcm.dll' rest /* \emx directory */ parse var date month '/' day '/' year say 'found EMX installed in: ' emxpath ' Version is ' day'.'month'.'year /* check version of exm, must be v 0.9d fix 4 */ replace='0' if year<01 then replace='1' if year>80 then replace='1' /* ... from last century.. */ if year=01 & month<3 then replace='1' if year=01 & month=3 & day<20 then replace='1' if replace=='1' then do say ' ' say 'EMX Version is to old, will be replaced with Version 0.9d Fix 4' say ' ' say ' (if "Access denied" is diplayed, then' say ' please reboot Your PC wihtout touching EMX' say ' and try again)' say ' ' say 'press any key to continue' pull . 'xcopy ' cddrv||'\emx\*.* ' emxpath||'\ /s' end /* if replace== */ end /* else do */ /* ----------------------------------------------------------------------- */ /* add dll to SET LIBPATH and bin to SET PATH */ /* ----------------------------------------------------------------------- */ oldcfg=bootdrv||'\config.sys' newcfg=bootdrv||'\config.new' 'if exist ' newcfg ' erase ' newcfg /* read CONFIG.SYS line by line */ do while lines(oldcfg) line=linein(oldcfg) /* read line */ linenew=translate(line) /* convert to upper case */ if pos('LIBPATH=',linenew) <> 0 then do /* LIBPATH found */ /* search existing EMX-DLL Path in LIBPATH */ emxdll=emxpath||'\dll' parse upper var emxdll emxdll '' rest /* convert to upper case */ emxdllfound='0' parse upper var line anfang '=' rest anfang = space(anfang) /* remove possible double blanks */ do while rest \= '' parse upper var rest next ';' rest if next==emxdll then emxdllfound='1' end /* do while */ if emxdllfound='1' then do say 'LIBPATH found with: ' emxdll ' no changes made' end /* then do */ else do say 'LIBPATH extended with ' emxdll if substr(line,length(line),1) == ';' /* ; at line end */ then sc = '' else sc = ';' line=line||sc||emxdll||';' end /* else do */ end /* if pos */ if pos('SET PATH=',linenew) <> 0 then do /* PATH found */ /* search existing EMX-BIN Path in PATH */ emxbin=emxpath||'\bin' parse upper var emxbin emxbin '' rest /* convert to upper case */ emxbinfound='0' parse upper var line anfang '=' rest anfang = space(anfang) /* remove possible double blanks */ do while rest \= '' parse upper var rest next ';' rest if next==emxbin then emxbinfound='1' end /* do while */ if emxbinfound='1' then do say 'SET PATH found with: ' emxbin ' no changes made' end /* then do */ else do say 'SET PATH extended with ' emxbin if substr(line,length(line),1) == ';' /* ; at line end */ then sc = '' else sc = ';' line=line||sc||emxbin||';' end /* else do */ end /* if pos */ call lineout newcfg,line /* write changed lines */ end /* do while lines */ /* close files */ call stream oldcfg,'c','close' call stream newcfg,'c','close' /* ----------------------------------------------------------------------- */ /* display meesage for required reboot */ /* ----------------------------------------------------------------------- */ say ' ' if emxbinfound='0'|emxdllfound='0' then do 'copy ' oldcfg bootdrv||'\config.emx' /* save old CONFIG.SYS */ 'copy ' newcfg oldcfg say 'old CONFIG.SYS is saved as CONFIG.EMX' say 'CONFIG.SYS has been changed, please reboot now' say ' -----------------' end /* if emxbinfound */