/* ----------------------------------------------------------------------- */ /* install APACHE 2 with PHP4 Module */ /* ----------------------------------------------------------------------- */ /* arg is the actual HOSTNAME value */ parse arg hostname if hostname=='' then hostname='a-net.demo.local' say 'Hostname ist: ' hostname /* 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 say '' /* first check, if emx is already installed on system */ say 'Suche EMX ...' rc=SysFileTree(bootdrv||'\emxlibcm.dll','emxloc.','FS') /* search for emxlibcm.dll */ if rc==0 then do say 'EMX scheint installiert zu sein in: ' say emxloc.1 end /* if rc==0 */ else do say 'EMX muss erst installiert sein' signal ende end /* else */ /* copy files */ drive=bootdrv apachedir='\a\apache2' /* apache directory OS/2 style */ say ' ' say 'Ŀ' say ' Installationslaufwerk whlen ' say '' say 'Apache 2 wird auf ' drive||apachedir ' kopiert' say '[Enter] falls o.k.,' say 'sonst Laufwerks-Buchstaben angeben:' pull answer if answer=='' then answer='C' if answer<>'' then do if substr(answer,length(answer),1) == ':' /* : am Zeilenende */ then dd = '' else dd = ':' drive=answer||dd end /* if answer */ say 'Falls erwnscht ein anderes Verzeichnis angeben, sonst [Enter]' parse pull answer2 if answer2<>'' then do if substr(answer2,length(answer2),1) == '\' /* remove \ at the end */ then answer2=substr(answer2,1,length(answer2)-1) if substr(answer2,1,1) == '\' /* \ at the beginning */ then answer2=substr(answer2,2,length(answer2)) apachedir='\'||answer2 end /* if answer2 */ apachedir = strip(apachedir) /* Trailing Blanks entfernen */ say 'apachedir: ' apachedir say 'Apache2 wird auf ' drive||apachedir||'\ kopiert' call SysSleep(4) say ' ' /* compute directory unix style (with '/' instead of '\') */ apachedirunix='' rest=apachedir i=0 do forever parse var rest part '\' rest say 'part: ' part ' rest: ' rest if part<>'' then apachedirunix=apachedirunix||'/'||part if rest=='' then leave end /* do forever */ 'xcopy \Apache2\*.* ' drive||apachedir||'\ /s /e' 'xcopy \php4\Apache20\modphp4.dll ' drive||apachedir||'\Modules\' 'xcopy \php4\php4.dll ' drive||apachedir||'\Modules\' 'xcopy \php4\modules\*.* ' drive||apachedir||'\Modules\' 'xcopy \php4\cgi\php.exe ' drive||apachedir||'\cgi\' /* ----------------------------------------------------------------------- */ /* create httpd.conf and activate PHP4 */ /* ----------------------------------------------------------------------- */ oldcfg=drive||apachedir||'\conf\httpd-std.conf' newcfg=drive||apachedir||'\conf\httpd.conf' 'if exist ' newcfg ' erase ' newcfg /* read httpd-std.conf line by line */ do while lines(oldcfg) line=linein(oldcfg) /* read line */ if pos('/Apps/apache2',line) <> 0 then do /* update directory */ /* replace '/Apps/apache2' with new directory */ parse var line part1 '/Apps/apache2' part2 line=part1||apachedirunix||part2 say 'folgende Zeile gendert:' say ' ' line end /* if pos */ if pos('#ServerName new.host.name:80',line) <> 0 then do /* hostname */ /* set hostname */ line='ServerName ' hostname||':80' say 'folgende Zeile gendert:' say ' ' line end /* if pos */ if pos('LoadModule access_module ',line) <> 0 then do /* first module */ /* add PHP4 module before */ linephp4='LoadModule php4_module modules/modphp4.dll' call lineout newcfg,linephp4 say 'folgende Zeile ergnzt:' say ' ' linephp4 end /* if pos */ if pos('AddType application/x-tar ',line) <> 0 then do /* first appli */ /* add PHP4 type before */ lineapp='AddType application/x-httpd-php .php' call lineout newcfg,lineapp say 'folgende Zeile ergnzt:' say ' ' lineapp 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' say ' ' say 'mache ICON' /* create start_apache.cmd for launching apache2 */ 'echo @echo off>' drive||apachedir||'\START_APACHE.CMD' 'echo echo Starten von Apache Server 2.0.47 unter OS/2>>' drive||apachedir||'\START_APACHE.CMD' 'echo set home=C:\home\>>' drive||apachedir||'\START_APACHE.CMD' 'echo set beginlibpath='||apachedir||'\bin;'||apachedir||'\modules;>>' drive||apachedir||'\START_APACHE.CMD' 'echo bin\httpd -d '||apachedirunix||'/htdocs -f 'apachedirunix||'/conf/httpd.conf>>' drive||apachedir||'\START_APACHE.CMD' /* create Desktop Icon */ If SysCreateObject("WPProgram","Apache 2.0.49","",, "OBJECTID=;"||, "EXENAME="drive||apachedir||"\START_APACHE.CMD;"||, "STARTUPDIR="drive||apachedir||";"||, "PROGTYPE=WINDOWABLEVIO;") Then Say '" Programm Apache 2.0" erstellt' Else Say '"Programm Apache 2.0" nicht erstellt' /* Icon created */ say ' ' say 'Sie knnen den Apache 2 nun via Icon auf dem Desktop starten' say 'Die html-Seiten sind in ' drive||apachedir||'\htdocs' say 'Starten Sie dann einen Browser und geben Sie folgende Adresse ein:' say 'http://localhost' say 'http://localhost/manual' say 'http://localhost/php_test.php' say ' ' say 'Soll Apache 2 jetzt gleich gestartet werden (J/N)?' parse upper pull answer if answer=='J' then do drive /* switch to drive with new installed apache */ 'cd ' apachedir 'start start_apache.cmd' say 'starte nun den Browser mit 2 Testseiten ...' say 'die Hauptseite und nach 15 Sekunden die PHP-Test-Seite' 'start netscape http://localhost' call SysSleep(15) 'start netscape http://localhost/php_test.php' 'cd \' end /* if answer */ cddrv /* switch back to installation drive */ ende: 'cd \'