REM replace paths
textreplace -sf apache/conf/httpd.conf -df apache/conf/httpd.conf -map @osgeo4w@ %OSGEO4W_ROOT%
textreplace -sf apache/conf/extra/httpd-autoindex.conf -df apache/conf/extra/httpd-autoindex.conf -map @osgeo4w@ %OSGEO4W_ROOT%
textreplace -sf apache/conf/httpd.conf -df apache/conf/httpd.conf -map @apache_port_number@  %APACHE_PORT%

REM create start menu links
mkdir "%OSGEO4W_STARTMENU%"
mkdir "%OSGEO4W_STARTMENU%\Apache"
xxmklink "%OSGEO4W_STARTMENU%\Apache\OSGEO4W-Apache-Install.lnk" %OSGEO4W_ROOT%\Apache\bin\httpd.exe " -k install -n \"Apache OSGEO4W Web Server\""
xxmklink "%OSGEO4W_STARTMENU%\Apache\OSGEO4W-Apache-Uninstall.lnk" %OSGEO4W_ROOT%\Apache\bin\httpd.exe " -k uninstall -n \"Apache OSGEO4W Web Server\""
xxmklink "%OSGEO4W_STARTMENU%\Apache\OSGEO4W-Apache-Start.lnk" %OSGEO4W_ROOT%\Apache\bin\httpd.exe " -k start -n \"Apache OSGEO4W Web Server\""
xxmklink "%OSGEO4W_STARTMENU%\Apache\OSGEO4W-Apache-Stop.lnk" %OSGEO4W_ROOT%\Apache\bin\httpd.exe " -k stop -n \"Apache OSGEO4W Web Server\""
xxmklink "%OSGEO4W_STARTMENU%\Apache\OSGEO4W-Apache-Monitor.lnk" %OSGEO4W_ROOT%\Apache\bin\ApacheMonitor.exe"

REM install and start the apache service
apache-install.bat