/* ----------------------------------------------------------------------- */ /* Install emx library for ported Unix apps */ /* Author: F. Hodel A-Net GmbH, www.anetgmbh.ch */ /* use at 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-Laufwerk ist ' bootdrv ' suche 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-Teile gefunden 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 'kein EMX aktiv, installiere nun EMX in ' 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 'EMX gefunden in: ' emxpath ' Version vom ' 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 ist zu alt, wird ersetzt mit Version 0.9d Fix 4' say ' ' say ' (Falls eine Meldung erscheint "Access denied" bitte den' say ' PC erst neu starten ohne EMX zu benutzen und dann' say ' nochmals probieren)' say ' ' say 'Druecken Sie eine beliebige Taste' pull . 'xcopy ' cddrv||'\emx\*.* ' emxpath||'\ /s' end /* if replace== */ end /* else do */ /* ----------------------------------------------------------------------- */ /* add dll to 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 gefunden mit: ' emxdll ' keine Aenderung' end /* then do */ else do say 'LIBPATH wird mit ' emxdll ' erweitert' if substr(line,length(line),1) == ';' /* ; am Zeilenende */ 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 gefunden mit: ' emxbin ' keine Aenderung' end /* then do */ else do say 'SET PATH wird mit ' emxbin ' erweitert' if substr(line,length(line),1) == ';' /* ; am Zeilenende */ 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 necessary reboot */ /* ----------------------------------------------------------------------- */ say ' ' if emxbinfound='0'|emxdllfound='0' then do 'copy ' oldcfg bootdrv||'\config.emx' /* save old CONFIG.SYS */ 'copy ' newcfg oldcfg say 'alter CONFIG.SYS gesichert unter CONFIG.EMX' say 'CONFIG.SYS ge„ndert, Neustart notwendig' say ' ------------------' end /* if emxbinfound */