Change Apache config directory to /etc/httpd
authorHugo Villeneuve <hugo@hugovil.com>
Fri, 28 Jun 2013 02:57:24 +0000 (22:57 -0400)
committerHugo Villeneuve <hugo@hugovil.com>
Fri, 28 Jun 2013 03:35:31 +0000 (23:35 -0400)
stage5/pkg/apache
stage5/pkg/php
stage5/post-install

index 19b5d04..ee38f22 100644 (file)
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+CONFDIR=/etc/httpd
+
 hvconfig_pre()
 {
     cd ${LFS_TMP}/${PACKAGE}
@@ -14,7 +16,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
@@ -49,14 +51,14 @@ 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
 
@@ -64,14 +66,14 @@ hvbuild_post()
     sed -i \
         -e "s!^\(User\).*!\1 ${APACHE_USER}!g" \
         -e "s!^\(Group\).*!\1 ${APACHE_USER}!g" \
-        /etc/apache/httpd.conf
+        ${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,18 +121,18 @@ 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!^<IfModule ssl_module>!<IfModule ssl_module>\n  Include /etc/apache/ssl/ssl.conf!" /etc/apache/httpd.conf
+    sed -i -e "s!^<IfModule ssl_module>!<IfModule ssl_module>\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
 
index c23ba58..5b34926 100644 (file)
@@ -45,15 +45,15 @@ hvbuild_post()
 
     # To enable PHP support in the Apache web server, a new AddType directive
     # must be added to the httpd.conf file.
-    if ! grep -q "application/x-httpd-php" /etc/apache/httpd.conf; then
-        echo "AddType application/x-httpd-php .php" >> /etc/apache/httpd.conf
+    if ! grep -q "application/x-httpd-php" /etc/httpd/httpd.conf; then
+        echo "AddType application/x-httpd-php .php" >> /etc/httpd/httpd.conf
     fi
 
     # Est-ce nĂ©cessaire?
     #cgi.discard_path = 1
 
-    if ! grep -q "DirectoryIndex" /etc/apache/httpd.conf | grep "index.php"; then
+    if ! grep -q "DirectoryIndex" /etc/httpd/httpd.conf | grep "index.php"; then
         sed -i -e "s!\(^\s*DirectoryIndex index.html.*\)!\1 index.php!g" \
-            /etc/apache/httpd.conf
+            /etc/httpd/httpd.conf
     fi
 }
index 3086b3a..aca3db4 100755 (executable)
@@ -31,7 +31,7 @@ if [ "x${INST_TYPE}" = "xserver" -o "x${INST_TYPE}" = "xltsp-server" ]; then
     done
 
     if [ "${USE_SSL}" = "y" ]; then
-       /etc/apache/generate-ssl-certs
+       /etc/httpd/generate-ssl-certs
     fi
 
     #########################################