X-Git-Url: http://gitweb.hugovil.com/?a=blobdiff_plain;ds=inline;f=stage5%2Fpkg%2Fapache;h=99b7de6dca4f453952be5987f13dd45773de244a;hb=2121ae9154ff063eef0defe0a9208663062a2d01;hp=19b5d040ef6ff79191e749f90a9d83b35b30e4d9;hpb=305cb288ba63239087a799237e8a3bd680b09b22;p=hvlinux.git
diff --git a/stage5/pkg/apache b/stage5/pkg/apache
index 19b5d04..99b7de6 100644
--- a/stage5/pkg/apache
+++ b/stage5/pkg/apache
@@ -1,10 +1,10 @@
#!/bin/bash
+CONFDIR=/etc/httpd
+
hvconfig_pre()
{
- cd ${LFS_TMP}/${PACKAGE}
-
- cat >> config.layout << "EOF" &&
+ cat >> ${SRC_DIR}/config.layout << "EOF" &&
# BLFS FHS layout
prefix: /usr
@@ -14,7 +14,7 @@ hvconfig_pre()
libdir: ${exec_prefix}/lib
libexecdir: ${exec_prefix}/libexec/apache
mandir: ${prefix}/share/man
- sysconfdir: /etc/apache
+ sysconfdir: /etc/httpd
datadir: /srv/www
installbuilddir: ${libexecdir}/build
errordir: ${datadir}/error
@@ -30,9 +30,9 @@ hvconfig_pre()
EOF
- groupadd -f ${APACHE_USER}
- hv_useradd -c WebServer -d /dev/null -g ${APACHE_USER} -s /bin/false \
- ${APACHE_USER}
+ groupadd --system -f ${HTTPD_USER}
+ hv_useradd --system -c WebServer -d /dev/null -g ${HTTPD_USER} \
+ -s /bin/false ${HTTPD_USER}
CONFIGURE_OPTS=" \
--enable-layout=FHS \
@@ -49,29 +49,29 @@ hvbuild_post()
/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/apache/httpd.conf
+ 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}" /etc/apache/httpd.conf; 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}%" \
- /etc/apache/httpd.conf
+ ${CONFDIR}/httpd.conf
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
+ -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"
+ cat > ${CONFDIR}/generate-ssl-certs << "EOF"
#!/bin/bash
# Creation of SSL directories for Apache
-cd /etc/apache
+cd ${CONFDIR}
mkdir -p ssl
cd ssl
@@ -119,24 +119,26 @@ openssl x509 -req -days 10000 -in server.csr -signkey server.key -out server.crt
exit $?
EOF
- chmod 740 /etc/apache/generate-ssl-certs
+ chmod 740 ${CONFDIR}/generate-ssl-certs
- mkdir -p /etc/apache/ssl
- cp /etc/apache/extra/httpd-ssl.conf /etc/apache/ssl/ssl.conf
+ mkdir -p ${CONFDIR}/ssl
+ cp ${CONFDIR}/extra/httpd-ssl.conf ${CONFDIR}/ssl/ssl.conf
- sed -i -e "s!^!\n Include /etc/apache/ssl/ssl.conf!" /etc/apache/httpd.conf
+ sed -i -e "s!^!\n Include ${CONFDIR}/ssl/ssl.conf!" ${CONFDIR}/httpd.conf
mkdir -p /srv/www/htdocs/ssl
- 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
+ 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
- chown -v -R ${APACHE_USER}:${APACHE_USER} /srv/www
+ chown -v -R ${HTTPD_USER}:${HTTPD_USER} /srv/www
# Bootscript
install -v -m740 ${SCRDIR}/bootscripts/apache /etc/rc.d/init.d
# script-name start stop
- bootscript_add_rc3 apache 70 20
+ if [ "x${DEFAULT_WEB_SERVER}" == "xhttpd" ]; then
+ bootscript_add_rc3 apache 70 20
+ fi
}