X-Git-Url: http://gitweb.hugovil.com/?a=blobdiff_plain;f=stage5%2Fpkg%2Fapache;h=8b6e66a0eb7c4512adaed86b483581cb9cf71e3b;hb=71a4362438cd17248be2046e845e48c638e309dd;hp=2aa25e189b274577772538b370da2effaf061e7d;hpb=3dae4c554ec18f465eb6ee5e6efdbdbe8557e13c;p=hvlinux.git
diff --git a/stage5/pkg/apache b/stage5/pkg/apache
index 2aa25e1..8b6e66a 100644
--- a/stage5/pkg/apache
+++ b/stage5/pkg/apache
@@ -1,57 +1,79 @@
-#!/bin/sh
-set -o errexit
-
-# First argument of this script is the package name
-
-# Reading system configuration informations, functions and package versions.
-source ../sysinfos
-source ../functions
-source ../packages-list
-
-# Applying patches (if any)
-apply_patches ${1}
-
-groupadd -f ${APACHE_USER}
-hv_useradd -c WebServer -d /dev/null -g ${APACHE_USER} -s /bin/false ${APACHE_USER}
-
-cd ${LFS_TMP}/${1}-build
-../${1}/configure \
- --enable-layout=FHS \
- --enable-mods-shared=all \
- --enable-ssl \
- --with-z
-# --enable-rewrite \
-# --enable-deflate \
-# --enable-dav \
-make
-make install
-
-# There's a problem with the ISAPI DSO module caused from compiling with GCC-4.1.2.
-# Commenting out the module from the configuration:
-if grep "LoadModule isapi_module" /etc/apache/httpd.conf 1> /dev/null 2>&1; then
- sed -i -e "s/^LoadModule isapi_module/# &/" /etc/apache/httpd.conf
-fi
-
-# Modifying the listening port if an alternate one is specified.
-if [ -n "${HTTPD_PORT}" ]; then
- if ! grep "Listen ${HTTPD_PORT}" /etc/apache/httpd.conf 1> /dev/null 2>&1; then
- # Adding alternate port to default port of 80
- sed -i -e "s%\(Listen 80\)%\1\nListen ${HTTPD_PORT}%" /etc/apache/httpd.conf
+#!/bin/bash
+
+CONFDIR=/etc/httpd
+
+hvconfig_pre()
+{
+ cd ${LFS_TMP}/${PACKAGE}
+
+ cat >> config.layout << "EOF" &&
+# BLFS FHS layout
+
+ prefix: /usr
+ exec_prefix: ${prefix}
+ bindir: ${exec_prefix}/bin
+ sbindir: ${exec_prefix}/sbin
+ libdir: ${exec_prefix}/lib
+ libexecdir: ${exec_prefix}/libexec/apache
+ mandir: ${prefix}/share/man
+ sysconfdir: /etc/httpd
+ datadir: /srv/www
+ installbuilddir: ${libexecdir}/build
+ errordir: ${datadir}/error
+ iconsdir: ${datadir}/icons
+ htdocsdir: ${datadir}/htdocs
+ manualdir: ${datadir}/manual
+ cgidir: ${datadir}/cgi-bin
+ includedir: ${prefix}/include/apache
+ localstatedir: ${datadir}
+ runtimedir: /var/run
+ logfiledir: /var/log/apache
+ proxycachedir: /var/cache/apache/proxy
+
+EOF
+
+ groupadd -f ${HTTPD_USER}
+ hv_useradd -c WebServer -d /dev/null -g ${HTTPD_USER} -s /bin/false \
+ ${HTTPD_USER}
+
+ CONFIGURE_OPTS=" \
+ --enable-layout=FHS \
+ --enable-mods-shared=all \
+ --enable-ssl \
+ --with-z"
+}
+
+hvbuild_post()
+{
+ chown -v root:root /usr/bin/{apxs,dbmmanage} \
+ /usr/sbin/{apachectl,envvars{,-std}} \
+ /usr/libexec/apache/httpd.exp \
+ /usr/share/man/man1/{ab,apxs,dbmmanage,ht{dbm,digest,passwd,txt2dbm},logresolve}.1 \
+ /usr/share/man/man8/{apachectl,htcacheclean,httpd,rotatelogs,suexec}.8 &&
+
+ sed -i -e "s!^\(DocumentRoot\) .*!\1 /srv/www/htdocs!" /etc/httpd/httpd.conf
+
+ # Modifying the listening port if an alternate one is specified.
+ if [ -n "${HTTPD_PORT}" ]; then
+ if ! grep -q "Listen ${HTTPD_PORT}" ${CONFDIR}/httpd.conf; then
+ # Adding alternate port to default port of 80
+ sed -i -e "s%\(Listen 80\)%\1\nListen ${HTTPD_PORT}%" \
+ ${CONFDIR}/httpd.conf
+ fi
fi
-fi
-# Modifying the configuration file to run the server as a dedicated user:
-sed -i \
- -e "s!^\(User\).*!\1 ${APACHE_USER}!g" \
- -e "s!^\(Group\).*!\1 ${APACHE_USER}!g" \
- /etc/apache/httpd.conf
+ # Modifying the configuration file to run the server as a dedicated user:
+ sed -i \
+ -e "s!^\(User\).*!\1 ${HTTPD_USER}!g" \
+ -e "s!^\(Group\).*!\1 ${HTTPD_USER}!g" \
+ ${CONFDIR}/httpd.conf
-# SSL Certificates generation script
-cat > /etc/apache/generate-ssl-certs << "EOF"
-#!/bin/sh
+ # SSL Certificates generation script
+ cat > ${CONFDIR}/generate-ssl-certs << "EOF"
+#!/bin/bash
# Creation of SSL directories for Apache
-cd /etc/apache
+cd ${CONFDIR}
mkdir -p ssl
cd ssl
@@ -99,25 +121,26 @@ openssl x509 -req -days 10000 -in server.csr -signkey server.key -out server.crt
exit $?
EOF
-chmod 740 /etc/apache/generate-ssl-certs
-
-mkdir -p /etc/apache/ssl
-cp /etc/apache/extra/httpd-ssl.conf /etc/apache/ssl/ssl.conf
+ chmod 740 ${CONFDIR}/generate-ssl-certs
-sed -i -e "s!^!\n Include /etc/apache/ssl/ssl.conf!" /etc/apache/httpd.conf
+ mkdir -p ${CONFDIR}/ssl
+ cp ${CONFDIR}/extra/httpd-ssl.conf ${CONFDIR}/ssl/ssl.conf
-mkdir -p /srv/www/htdocs/ssl
-chown apache:apache /srv/www/htdocs/ssl
+ sed -i -e "s!^!\n Include ${CONFDIR}/ssl/ssl.conf!" ${CONFDIR}/httpd.conf
-sed -i -e "s!^DocumentRoot .*!DocumentRoot /srv/www/htdocs/ssl!" /etc/apache/ssl/ssl.conf
-sed -i -e "s!^ServerName .*:443!ServerName www.${DOMAIN}:443!" /etc/apache/ssl/ssl.conf
-sed -i -e "s!^ServerAdmin .*!ServerAdmin webmaster@${DOMAIN}!" /etc/apache/ssl/ssl.conf
-sed -i -e "s!/etc/apache!/etc/apache/ssl!" /etc/apache/ssl/ssl.conf
+ mkdir -p /srv/www/htdocs/ssl
+ sed -i -e "s!^DocumentRoot .*!DocumentRoot /srv/www/htdocs/ssl!" ${CONFDIR}/ssl/ssl.conf
+ sed -i -e "s!^ServerName .*:443!ServerName www.${DOMAIN}:443!" ${CONFDIR}/ssl/ssl.conf
+ sed -i -e "s!^ServerAdmin .*!ServerAdmin webmaster@${DOMAIN}!" ${CONFDIR}/ssl/ssl.conf
+ sed -i -e "s!${CONFDIR}!${CONFDIR}/ssl!" ${CONFDIR}/ssl/ssl.conf
-# Bootscript
-install -v -m740 ${SCRDIR}/bootscripts/apache /etc/rc.d/init.d
+ chown -v -R ${HTTPD_USER}:${HTTPD_USER} /srv/www
-# script-name start stop
-bootscript_add_rc3 apache 70 20
+ # Bootscript
+ install -v -m740 ${SCRDIR}/bootscripts/apache /etc/rc.d/init.d
-exit $?
+ # script-name start stop
+ if [ "x${DEFAULT_WEB_SERVER}" == "xhttpd" ]; then
+ bootscript_add_rc3 apache 70 20
+ fi
+}